Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 5348 → Rev 5347

/programs/games/rstearth/i_data.inc
0,0 → 1,326
;---------------------------------------------------------------------
; initialized data
;---------------------------------------------------------------------
plugins_directory db 0
 
;system_dir_Boxlib db '/sys/lib/box_lib.obj',0
system_dir_CnvPNG db '/sys/lib/cnv_png.obj',0
system_dir_UNPACK db '/sys/lib/archiver.obj',0
 
ihead_f_i:
ihead_f_l db 'System error',0
 
;er_message_found_lib db 'box_lib.obj - Not found!',0
;er_message_import db 'box_lib.obj - Wrong import!',0
 
er_message_found_lib2 db 'cnv_png.obj - Not found!',0
er_message_import2 db 'cnv_png.obj - Wrong import!',0
 
err_message_found_lib3 db 'archiver.obj - Not found!',0
err_message_import3 db 'archiver.obj - Wrong import!',0
 
align 4
l_libs_start:
;library01 l_libs system_dir_Boxlib+9,path,file_name,system_dir_Boxlib,\
;er_message_found_lib,ihead_f_l,Box_lib_import,er_message_import,ihead_f_i,plugins_directory
 
library02 l_libs system_dir_CnvPNG+9,path,file_name,system_dir_CnvPNG,\
er_message_found_lib2,ihead_f_l,cnv_png_import,er_message_import2,ihead_f_i,plugins_directory
 
library04 l_libs system_dir_UNPACK+9,path,file_name,system_dir_UNPACK,\
err_message_found_lib3,ihead_f_l,UNPACK_import,err_message_import3,ihead_f_i,plugins_directory
end_l_libs:
;---------------------------------------------------------------------
align 4
UNPACK_import:
;unpack_Version dd aUnpack_Version
;unpack_PluginLoad dd aUnpack_PluginLoad
;unpack_OpenFilePlugin dd aUnpack_OpenFilePlugin
;unpack_ClosePlugin dd aUnpack_ClosePlugin
;unpack_ReadFolder dd aUnpack_ReadFolder
;unpack_SetFolder dd aUnpack_SetFolder
;unpack_GetFiles dd aUnpack_GetFiles
;unpack_GetOpenPluginInfo dd aUnpack_GetOpenPluginInfo
;unpack_Getattr dd aUnpack_Getattr
;unpack_Open dd aUnpack_Open
;unpack_Read dd aUnpack_Read
;unpack_Setpos dd aUnpack_Setpos
;unpack_Close dd aUnpack_Close
;unpack_DeflateUnpack dd aUnpack_DeflateUnpack
unpack_DeflateUnpack2 dd aUnpack_DeflateUnpack2
dd 0
dd 0
 
;aUnpack_Version db 'version',0
;aUnpack_PluginLoad db 'plugin_load',0
;aUnpack_OpenFilePlugin db 'OpenFilePlugin',0
;aUnpack_ClosePlugin db 'ClosePlugin',0
;aUnpack_ReadFolder db 'ReadFolder',0
;aUnpack_SetFolder db 'SetFolder',0
;aUnpack_GetFiles db 'GetFiles',0
;aUnpack_GetOpenPluginInfo db 'GetOpenPluginInfo',0
;aUnpack_Getattr db 'getattr',0
;aUnpack_Open db 'open',0
;aUnpack_Read db 'read',0
;aUnpack_Setpos db 'setpos',0
;aUnpack_Close db 'close',0
;aUnpack_DeflateUnpack db 'deflate_unpack',0
aUnpack_DeflateUnpack2 db 'deflate_unpack2',0
 
;---------------------------------------------------------------------
align 4
cnv_png_import:
.Start dd aCP_Start
;.Version dd aCP_Version
;.Check dd aCP_Check
;.Assoc dd aCP_Assoc
dd 0
dd 0
aCP_Start db 'START',0
;aCP_Version db 'version',0
;aCP_Check db 'Check_Header',0
;aCP_Assoc db 'Associations',0
;---------------------------------------------------------------------
;align 4
;Box_lib_import:
;init_lib dd a_init
;version_lib dd a_version
 
 
;edit_box_draw dd aEdit_box_draw
;edit_box_key dd aEdit_box_key
;edit_box_mouse dd aEdit_box_mouse
;version_ed dd aVersion_ed
 
;check_box_draw dd aCheck_box_draw
;check_box_mouse dd aCheck_box_mouse
;version_ch dd aVersion_ch
 
;option_box_draw dd aOption_box_draw
;option_box_mouse dd aOption_box_mouse
;version_op dd aVersion_op
 
;scrollbar_ver_draw dd aScrollbar_ver_draw
;scrollbar_ver_mouse dd aScrollbar_ver_mouse
;scrollbar_hor_draw dd aScrollbar_hor_draw
;scrollbar_hor_mouse dd aScrollbar_hor_mouse
;version_scrollbar dd aVersion_scrollbar
 
;dinamic_button_draw dd aDbutton_draw
;dinamic_button_mouse dd aDbutton_mouse
;version_dbutton dd aVersion_dbutton
 
;menu_bar_draw dd aMenu_bar_draw
;menu_bar_mouse dd aMenu_bar_mouse
;menu_bar_activate dd aMenu_bar_activate
;version_menu_bar dd aVersion_menu_bar
 
;FileBrowser_draw dd aFileBrowser_draw
;FileBrowser_mouse dd aFileBrowser_mouse
;FileBrowser_key dd aFileBrowser_key
;Version_FileBrowser dd aVersion_FileBrowser
 
;PathShow_prepare dd sz_PathShow_prepare
;PathShow_draw dd sz_PathShow_draw
;Version_path_show dd szVersion_path_show
; dd 0
; dd 0
 
;a_init db 'lib_init',0
;a_version db 'version',0
 
;aEdit_box_draw db 'edit_box',0
;aEdit_box_key db 'edit_box_key',0
;aEdit_box_mouse db 'edit_box_mouse',0
;aVersion_ed db 'version_ed',0
 
;aCheck_box_draw db 'check_box_draw',0
;aCheck_box_mouse db 'check_box_mouse',0
;aVersion_ch db 'version_ch',0
 
;aOption_box_draw db 'option_box_draw',0
;aOption_box_mouse db 'option_box_mouse',0
;aVersion_op db 'version_op',0
 
;aScrollbar_ver_draw db 'scrollbar_v_draw',0
;aScrollbar_ver_mouse db 'scrollbar_v_mouse',0
;aScrollbar_hor_draw db 'scrollbar_h_draw',0
;aScrollbar_hor_mouse db 'scrollbar_h_mouse',0
;aVersion_scrollbar db 'version_scrollbar',0
 
;aDbutton_draw db 'dbutton_draw',0
;aDbutton_mouse db 'dbutton_mouse',0
;aVersion_dbutton db 'version_dbutton',0
 
;aMenu_bar_draw db 'menu_bar_draw',0
;aMenu_bar_mouse db 'menu_bar_mouse',0
;aMenu_bar_activate db 'menu_bar_activate',0
;aVersion_menu_bar db 'version_menu_bar',0
 
;aFileBrowser_draw db 'FileBrowser_draw',0
;aFileBrowser_mouse db 'FileBrowser_mouse',0
;aFileBrowser_key db 'FileBrowser_key',0
;aVersion_FileBrowser db 'version_FileBrowser',0
 
;sz_PathShow_prepare db 'PathShow_prepare',0
;sz_PathShow_draw db 'PathShow_draw',0
;szVersion_path_show db 'version_PathShow',0
;---------------------------------------------------------------------
 
;---------------------------------------------------------------------
; not change this section!!!
; start section
;---------------------------------------------------------------------
align 4
image_file dd 0
raw_pointer dd 0
return_code dd 0
img_size dd 0
deflate_unpack dd 0
raw_pointer_2 dd 0 ;+20
;---------------------------------------------------------------------
; end section
;---------------------------------------------------------------------
align 4
fileinfo:
.subfunction dd 5
.Offset dd 0
.Offset_1 dd 0
.size dd 0
.return dd file_info
db 0
.name: dd file_name
;---------------------------------------------------------------------
error_window_x: dd 100 shl 16+250
error_window_y: dd 100 shl 16+120
;---------------------------------------------------------------------
load_ini_error_type:
db 'Error loading INI file',0
 
load_icons_error_type:
db 'Error loading of icons file',0
 
memory_free_error_type:
db 'Error of free memory',0
 
memory_get_error_type:
db 'Memory allocation error',0
 
load_directory_error_type:
db 'Error loading directory',0
 
convert_icons_error_type:
db 'Unsupported or corrupt data for icons file',0
;---------------------------------------------------------------------
error_help_text:
db 'For continue press <Esc> key or <Cancel>',0
;---------------------------------------------------------------------
align 4
error_fs_text_pointers:
dd error_fs_text_0
dd error_fs_text_1
dd error_fs_text_2
dd error_fs_text_3
dd error_fs_text_4
dd error_fs_text_5
dd error_fs_text_6
dd error_fs_text_7
dd error_fs_text_8
dd error_fs_text_9
dd error_fs_text_10
dd error_fs_text_11
 
error_fs_text_0: db '0 - Success full',0
error_fs_text_1: db '1 - Base and/or partition of a hard disk is not defined',0
error_fs_text_2: db '2 - Function is not supported for the given file system',0
error_fs_text_3: db '3 - Unknown file system',0
error_fs_text_4: db '4 - Reserved, is never returned in the current implementation',0
error_fs_text_5: db '5 - File not found',0
error_fs_text_6: db '6 - End of file, EOF',0
error_fs_text_7: db '7 - Pointer lies outside of application memory',0
error_fs_text_8: db '8 - Disk is full',0
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
npc_miku_icons_file_name db 'miku_8bpp.png',0
npc_death_icons_file_name db 'death_8bpp.png',0
npc_skeleton_icons_file_name db 'skeleton_8bpp.png',0
npc_ifrit_icons_file_name db 'ifrit_8bpp.png',0
npc_barret_icons_file_name db 'barret_8bpp.png',0
background_music_file_name db 'walking_with_poseidon.wav',0
stone_kick_sound_file_name db 'flaunch.wav',0
menu_sound_file_name db 'misc_menu.wav',0
;---------------------------------------------------------------------
align 4
protagonist_route dd 2
protagonist_position:
.x dd 4
.y dd 4
;---------------------------------------------------------------------
align 4
main_menu_text_pointers:
dd menu_game_label
dd menu_settings_label
dd menu_credits_label
dd menu_help_label
dd menu_exit_label
dd 0
;---------------------------------------------------------------------
align 4
menu_credits_text_pointers:
dd space_line
dd menu_credits_text.1
dd menu_credits_text.2
dd space_line
dd menu_credits_text.3
dd menu_credits_text.4
dd menu_credits_text.5
dd space_line
dd menu_credits_text.6
dd menu_credits_text.7
dd space_line
dd menu_credits_text.8
dd menu_credits_text.9
dd space_line
dd menu_credits_text.10
dd menu_credits_text.11
dd space_line
dd menu_credits_text.12
dd 0
;---------------------------------------------------------------------
align 4
menu_help_text_pointers:
dd menu_help_text.1
dd menu_help_text.2
dd menu_help_text.3
dd menu_help_text.4
dd menu_help_text.5
dd 0
;---------------------------------------------------------------------
align 4
settings_menu_text_pointers:
dd menu_settings_sound_label
dd menu_settings_music_label
dd menu_setting_exit
dd 0
;---------------------------------------------------------------------
align 4
map_level_pointer:
dd map_level_0
dd map_level_1
dd map_level_2
dd map_level_3
dd map_level_4
dd map_level_5
dd map_level_6
dd map_level_7
dd map_level_8
dd map_level_9
dd map_level_10
dd 0
;---------------------------------------------------------------------
/programs/games/rstearth/localization_eng.inc
0,0 → 1,73
;---------------------------------------------------------------------
title:
db 'Rusty Earth 31.12.2014',0
;---------------------------------------------------------------------
menu_game_label:
db 'GAME',0
;--------------------------------------
menu_settings_label:
db 'SETTINGS',0
;--------------------------------------
menu_credits_label:
db 'CREDITS',0
;--------------------------------------
menu_help_label:
db 'HELP',0
;--------------------------------------
menu_exit_label:
db 'EXIT',0
;---------------------------------------------------------------------
menu_settings_sound_label:
db 'SOUNDS OFF',0
;--------------------------------------
menu_settings_music_label:
db 'MUSIC OFF',0
;--------------------------------------
text_off_label:
db 'OFF',0
;--------------------------------------
text_on_label:
db 'ON ',0
;--------------------------------------
menu_setting_exit:
db 'EXIT',0
;---------------------------------------------------------------------
stage_text:
db 'LEVEL '
.1: db '00',0
;--------------------------------------
game_win_text:
db 'YES! YOU WIN!',0
;--------------------------------------
protagonist_death_text:
db 'REST IN PEACE',0
;---------------------------------------------------------------------
menu_credits_text:
.1: db 'Hello KolibriOS Team!',0
.2: db ' Hello Habrahabr!',0
 
.3: db 'The game used graphics and sound material',0
.4: db 'under a free license, borrowed from:',0
.5: db ' http://opengameart.org',0
 
.6: db 'NPC sprites by',0
.7: db ' http://untamed.wild-refuge.net',0
 
.8: db 'Hatsune Miku Sprites by',0
.9: db ' http://nekorandomnessqueen.deviantart.com',0
 
.10: db 'Glyphs of Russo free font by',0
.11: db ' http://www.jovanny.ru',0
 
.12: db 'Game author - Marat Zakiyanov aka Mario79',0
;---------------------------------------------------------------------
menu_help_text:
.1: db ' Control',0
.2: db ' WASD',0
.3: db ' Arrows',0
.4: db ' Num8462',0
.5: db 'Kick SPACE',0
;---------------------------------------------------------------------
space_line:
db 0
;---------------------------------------------------------------------
/programs/games/rstearth/localization_rus.inc
0,0 → 1,75
;---------------------------------------------------------------------
; Code page - Cyrillic OEM866
;---------------------------------------------------------------------
title:
db '¦ ¢ ï ‡¥¬«ï 31.12.2014',0
;---------------------------------------------------------------------
menu_game_label:
db 'ˆƒ€',0
;--------------------------------------
menu_settings_label:
db '€‘’Ž‰Šˆ',0
;--------------------------------------
menu_credits_label:
db 'ˆ‚…’›',0
;--------------------------------------
menu_help_label:
db 'ŽŒŽ™œ',0
;--------------------------------------
menu_exit_label:
db '‚›•Ž„',0
;---------------------------------------------------------------------
menu_settings_sound_label:
db '‡‚“Šˆ ‚›Š‹',0
;--------------------------------------
menu_settings_music_label:
db 'Œ“‡›Š€ ‚›Š‹',0
;--------------------------------------
text_off_label:
db '‚›Š‹',0
;--------------------------------------
text_on_label:
db '‚Š‹',0
;--------------------------------------
menu_setting_exit:
db '‚›•Ž„',0
;---------------------------------------------------------------------
stage_text:
db '“Ž‚…œ '
.1: db '00',0
;--------------------------------------
game_win_text:
db '“€! Ž…„€!',0
;--------------------------------------
protagonist_death_text:
db '’Ž ›‹ ŠŽ…–',0
;---------------------------------------------------------------------
menu_credits_text:
.1: db 'à¨¢¥â KolibriOS Team!',0
.2: db ' à¨¢¥â • ¡à å ¡à!',0
 
.3: db 'ƒà ä¨ç¥áª¨¥ ¨ §¢ãª®¢ë¥ ¬ â¥à¨ «ë ¯®¤',0
.4: db '᢮¡®¤­ë¬¨ «¨æ¥­§¨ï¬¨, ¢§ïâë á á ©â ',0
.5: db ' http://opengameart.org',0
 
.6: db '‘¯à ©âë NPC ¢§ïâë á á ©â ',0
.7: db ' http://untamed.wild-refuge.net',0
 
.8: db 'C¯à ©âë Œ¨ªã • æã­í ®â',0
.9: db ' http://nekorandomnessqueen.deviantart.com',0
 
.10: db 'ƒ«¨äë ᢮¡®¤­®£® èà¨äâ  Russo ®â',0
.11: db ' http://www.jovanny.ru',0
 
.12: db '€¢â®à ¨£àë - Œ à â ‡ ª¨ï­®¢ aka Mario79',0
;---------------------------------------------------------------------
menu_help_text:
.1: db '“¯à ¢«¥­¨¥',0
.2: db ' WASD',0
.3: db ' áâ५ª¨',0
.4: db '¨«¨ Num8462',0
.5: db '“¤ à SPACE',0
;---------------------------------------------------------------------
space_line:
db 0
;---------------------------------------------------------------------
/programs/games/rstearth/menu.inc
0,0 → 1,421
;---------------------------------------------------------------------
main_menu_start:
mov [main_menu_pointer],0
mov eax,[menu_sound]
mov [sounds_sample],eax
;--------------------------------------
.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
;---------------------------------------------------------------------
.still:
mcall 10
 
cmp eax,1
je .red
 
cmp eax,2
je .key
 
cmp eax,3
je .button
jmp .still
;---------------------------------------------------------------------
.key:
mcall 2
cmp [extended_key],1
je .extended_key
 
test al,al
jnz .still
 
cmp ah,0xE0
jne @f
 
mov [extended_key],1
jmp .still
;--------------------------------------
@@:
cmp ah,72 ; arrow up
je .arrow_up
 
cmp ah,80 ; arrow down
je .arrow_down
 
cmp ah,17 ; w - arrow up
je .arrow_up
 
cmp ah,31 ; s - arrow down
je .arrow_down
 
cmp ah,57 ; space
je .enter_to_point
cmp ah,28 ; enter
je .enter_to_point
 
jmp .still
;---------------------------------------------------------------------
.extended_key:
mov [extended_key],0
cmp ah,72 ; arrow up
je .arrow_up
 
cmp ah,80 ; arrow down
je .arrow_down
jmp .still
;---------------------------------------------------------------------
.arrow_up:
cmp [main_menu_pointer],0
je .still
call snd_kick_action
call clear_old_pointer
dec [main_menu_pointer]
call draw_new_pointer
jmp .still
;---------------------------------------------------------------------
.arrow_down:
cmp [main_menu_pointer],4
je .still
call snd_kick_action
call clear_old_pointer
inc [main_menu_pointer]
call draw_new_pointer
jmp .still
;---------------------------------------------------------------------
.enter_to_point:
cmp [main_menu_pointer],0 ; game
je start_level_0
cmp [main_menu_pointer],1 ; settings
je settings_menu_start
 
cmp [main_menu_pointer],2 ; credits
je menu_credits
cmp [main_menu_pointer],3 ; help
je menu_help
 
cmp [main_menu_pointer],4 ; exit
je button.exit
jmp .still
;---------------------------------------------------------------------
.button:
mcall 17
 
cmp ah,1
jne .still
jmp button.exit
;---------------------------------------------------------------------
clear_old_pointer:
movzx ecx,byte [main_menu_pointer]
imul ecx,SPRITE_SIZE_Y
add ecx,SPRITE_SIZE_Y*3 - 16
shl ecx,16
mov cx,SPRITE_SIZE_Y
mcall 13,<SPRITE_SIZE_X*2,SPRITE_SIZE_X>,,0
ret
;---------------------------------------------------------------------
draw_new_pointer:
; movzx ecx,byte [main_menu_pointer]
; imul ecx,SPRITE_SIZE_Y
; add ecx,SPRITE_SIZE_Y*2
; shl ecx,16
; mov cx,SPRITE_SIZE_Y
; mcall 13,<SPRITE_SIZE_X*1,SPRITE_SIZE_X>,,0xff0000
 
movzx edx,byte [main_menu_pointer]
imul edx,SPRITE_SIZE_Y
add edx,SPRITE_SIZE_Y*3 - 16
add edx,SPRITE_SIZE_X*2 shl 16
mov eax,[npc_miku_icons]
mov ebp,SPRITE_SIZE_X*SPRITE_SIZE_Y*12
call copy_base_8bpp
xor ebp,ebp
mcall 65,buffer_area,<SPRITE_SIZE_X,SPRITE_SIZE_Y>,,32
ret
;---------------------------------------------------------------------
draw_menu_window:
mcall 12,1
mcall 48,4
mov ecx,100 shl 16 + 644
add cx,ax
mcall 0,<100,649>,,0x74AABBCC,,title
call clear_screen
 
mov eax,4
mov ebx,SPRITE_SIZE_X*3 shl 16 + SPRITE_SIZE_Y*2
cmp [use_separate_draw_text],0
je @f
add ebx,SPRITE_SIZE_Y
;--------------------------------------
@@:
mov ecx,0x90ffffff
mov esi,[menu_text_pointers]
;--------------------------------------
@@:
mov edx,[esi]
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
;--------------------------------------
.end:
 
mcall 12,2
ret
;---------------------------------------------------------------------
clear_screen:
xor edx,edx
mcall 13,<0,SPRITE_SIZE_X*LEVEL_MAP_SIZE_X>,<0,SPRITE_SIZE_Y*LEVEL_MAP_SIZE_Y>
ret
;---------------------------------------------------------------------
menu_credits:
call snd_kick_action
mov [menu_text_pointers],menu_credits_text_pointers
mov [use_separate_draw_text],0
mov [text_step_Y],20
jmp menu_help.1
;---------------------------------------------------------------------
menu_help:
call snd_kick_action
mov [menu_text_pointers],menu_help_text_pointers
mov [text_step_Y],SPRITE_SIZE_Y
;--------------------------------------
.1:
 
;--------------------------------------
.red:
call draw_menu_window
;---------------------------------------------------------------------
.still:
mcall 10
 
cmp eax,1
je .red
 
cmp eax,2
je .key
 
cmp eax,3
je .button
jmp .still
;---------------------------------------------------------------------
.key:
mcall 2
cmp [extended_key],1
je .extended_key
 
test al,al
jnz .still
 
cmp ah,0xE0
jne @f
 
mov [extended_key],1
jmp .still
;--------------------------------------
@@:
cmp ah,57 ; space
je main_menu_start.red
 
cmp ah,28 ; enter
je main_menu_start.red
 
cmp ah,1 ; esc
je main_menu_start.red
 
jmp .still
;---------------------------------------------------------------------
.extended_key:
mov [extended_key],0
 
jmp .still
;---------------------------------------------------------------------
.button:
mcall 17
 
cmp ah,1
jne .still
jmp button.exit
;---------------------------------------------------------------------
settings_menu_start:
call snd_kick_action
mov al,[main_menu_pointer]
mov [settings_menu_pointer],al
xor al,al
mov [main_menu_pointer],al
;--------------------------------------
.red:
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
;---------------------------------------------------------------------
.still:
mcall 10
 
cmp eax,1
je .red
 
cmp eax,2
je .key
 
cmp eax,3
je .button
jmp .still
;---------------------------------------------------------------------
.key:
mcall 2
cmp [extended_key],1
je .extended_key
 
test al,al
jnz .still
 
cmp ah,0xE0
jne @f
 
mov [extended_key],1
jmp .still
;--------------------------------------
@@:
cmp ah,72 ; arrow up
je .arrow_up
 
cmp ah,80 ; arrow down
je .arrow_down
 
cmp ah,17 ; w - arrow up
je .arrow_up
 
cmp ah,31 ; s - arrow down
je .arrow_down
 
cmp ah,57 ; space
je .enter_to_point
cmp ah,28 ; enter
je .enter_to_point
cmp ah,1 ; esc
je .exit
 
jmp .still
;---------------------------------------------------------------------
.extended_key:
mov [extended_key],0
cmp ah,72 ; arrow up
je .arrow_up
 
cmp ah,80 ; arrow down
je .arrow_down
jmp .still
;---------------------------------------------------------------------
.arrow_up:
cmp [main_menu_pointer],0
je .still
call snd_kick_action
call clear_old_pointer
dec [main_menu_pointer]
call draw_new_pointer
jmp .still
;---------------------------------------------------------------------
.arrow_down:
cmp [main_menu_pointer],2
je .still
call snd_kick_action
call clear_old_pointer
inc [main_menu_pointer]
call draw_new_pointer
jmp .still
;---------------------------------------------------------------------
.enter_to_point:
cmp [main_menu_pointer],0 ; sounds
jne @f
inc [sounds_flag]
and [sounds_flag],1b
jmp .red
;--------------------------------------
@@:
cmp [main_menu_pointer],1 ; music
jne @f
inc [music_flag]
and [music_flag],1b
jmp .red
;--------------------------------------
@@:
cmp [main_menu_pointer],2 ; exit
jne .still
 
;--------------------------------------
.exit:
call snd_kick_action
mov al,[settings_menu_pointer]
mov [main_menu_pointer],al
 
jmp main_menu_start.red
;---------------------------------------------------------------------
.button:
mcall 17
 
cmp ah,1
jne .still
jmp button.exit
;---------------------------------------------------------------------
prepare_settings_text:
mov eax,[text_on_label]
cmp [sounds_flag],1
je @f
mov eax,[text_off_label]
;--------------------------------------
@@:
mov [menu_settings_sound_label+7],eax
;--------------------------------------
mov eax,[text_on_label]
cmp [music_flag],1
je @f
mov eax,[text_off_label]
;--------------------------------------
@@:
mov [menu_settings_music_label+7],eax
ret
;---------------------------------------------------------------------
/programs/games/rstearth/actions_protagonist.inc
0,0 → 1,97
;---------------------------------------------------------------------
processing_protagonist_action:
;; DEBUGF 1, "processing_protagonist_action\n"
cmp dl,ROUTE_UP
je protagonist_route_up
 
cmp dl,ROUTE_DOWN
je protagonist_route_down
 
cmp dl,ROUTE_LEFT
je protagonist_route_left
 
cmp dl,ROUTE_RIGHT
je protagonist_route_right
 
ret
;---------------------------------------------------------------------
protagonist_route_up:
; DEBUGF 1, "protagonist route_up\n"
cmp ebx,1 ; border of map?
je action_stop
 
; DEBUGF 1, "protagonist up @@:\n"
mov eax,[ecx-LEVEL_MAP_SIZE_X*4]
test ah,ah
jnz action_stop
; cmp al,BASE_WATER
; jz action_stop
; DEBUGF 1, "protagonist good route up\n"
dec [protagonist_position.y]
mov si,0x0100+ROUTE_UP
mov edi,ecx
sub edi,LEVEL_MAP_SIZE_X*4
jmp save_new_and_clear_old_position
;---------------------------------------------------------------------
protagonist_route_down:
; DEBUGF 1, "protagonist route_down\n"
cmp ebx,LEVEL_MAP_SIZE_Y ; border of map?
je action_stop
 
; DEBUGF 1, "protagonist down @@:\n"
mov eax,[ecx+LEVEL_MAP_SIZE_X*4]
test ah,ah
jnz action_stop
 
; cmp al,BASE_WATER
; jz action_stop
; DEBUGF 1, "protagonist good route down\n"
inc [protagonist_position.y]
mov si,0x0100+ROUTE_DOWN
mov edi,ecx
add edi,LEVEL_MAP_SIZE_X*4
jmp save_new_and_clear_old_position
;---------------------------------------------------------------------
protagonist_route_left:
; DEBUGF 1, "protagonist route_left\n"
cmp eax,1 ; border of map?
je action_stop
 
; DEBUGF 1, "protagonist left @@:\n"
mov eax,[ecx-4]
test ah,ah
jnz action_stop
 
; cmp al,BASE_WATER
; jz action_stop
; DEBUGF 1, "protagonist good route left\n"
dec [protagonist_position.x]
mov si,0x0100+ROUTE_LEFT
mov edi,ecx
sub edi,4
jmp save_new_and_clear_old_position
;---------------------------------------------------------------------
protagonist_route_right:
; DEBUGF 1, "protagonist route_right\n"
cmp eax,LEVEL_MAP_SIZE_X ; border of map?
je action_stop
 
; DEBUGF 1, "protagonist righ @@:\n"
mov eax,[ecx+4]
test ah,ah
jnz action_stop
 
; cmp al,BASE_WATER
; jz action_stop
; DEBUGF 1, "protagonist good route righ\n"
inc [protagonist_position.x]
mov si,0x0100+ROUTE_RIGHT
mov edi,ecx
add edi,4
jmp save_new_and_clear_old_position
;---------------------------------------------------------------------
/programs/games/rstearth/key.inc
0,0 → 1,260
;---------------------------------------------------------------------
key:
mcall 2
cmp [extended_key],1
je .extended_key
 
test al,al
jnz still
 
cmp ah,0xE0
jne @f
 
mov [extended_key],1
jmp still
;--------------------------------------
@@:
cmp ah,72 ; arrow up
je .arrow_up
 
cmp ah,80 ; arrow down
je .arrow_down
 
cmp ah,75 ; arrow left
je .arrow_left
 
cmp ah,77 ; arrow right
je .arrow_right
 
cmp ah,17 ; w - arrow up
je .arrow_up
 
cmp ah,31 ; s - arrow down
je .arrow_down
 
cmp ah,30 ; a - arrow left
je .arrow_left
 
cmp ah,32 ; d - arrow right
je .arrow_right
 
cmp ah,57 ; space - kick
je .kick
 
jmp still
;---------------------------------------------------------------------
.extended_key:
mov [extended_key],0
cmp ah,72 ; arrow up
je .arrow_up
 
cmp ah,80 ; arrow down
je .arrow_down
 
cmp ah,75 ; arrow left
je .arrow_left
 
cmp ah,77 ; arrow right
je .arrow_right
 
jmp still
;---------------------------------------------------------------------
.arrow_up:
mov [protagonist_route],ROUTE_UP
mov cx,0x0100+ROUTE_UP
jmp .save_motion
;---------------------------------------------------------------------
.arrow_down:
mov [protagonist_route],ROUTE_DOWN
mov cx,0x0100+ROUTE_DOWN
jmp .save_motion
;---------------------------------------------------------------------
.arrow_left:
mov [protagonist_route],ROUTE_LEFT
mov cx,0x0100+ROUTE_LEFT
jmp .save_motion
;---------------------------------------------------------------------
.arrow_right:
mov [protagonist_route],ROUTE_RIGHT
mov cx,0x0100+ROUTE_RIGHT
;---------------------------------------------------------------------
.save_motion:
call calculate_offset
shl ebx,2
add eax,ebx
add eax,plan_level
mov ebx,[eax]
ror ebx,16
mov bx,cx
rol ebx,16
mov [eax],ebx
; jmp still
jmp calculate_action_for_all.2
;---------------------------------------------------------------------
.kick:
mov eax,[protagonist_route]
cmp al,ROUTE_UP
jne @f
cmp [protagonist_position.y],0
je calculate_action_for_all.1 ;still
call protagonist_kick_action
mov eax,[protagonist_position.y]
dec eax
call calculate_offset.1
jmp .calculate_protagonist_kick_brick
;--------------------------------------
@@:
cmp al,ROUTE_DOWN
jne @f
 
cmp [protagonist_position.y],LEVEL_MAP_SIZE_Y-1
je calculate_action_for_all.1 ;still
 
call protagonist_kick_action
mov eax,[protagonist_position.y]
inc eax
call calculate_offset.1
jmp .calculate_protagonist_kick_brick
;--------------------------------------
@@:
cmp al,ROUTE_LEFT
jne @f
 
cmp [protagonist_position.x],0
je calculate_action_for_all.1 ;still
 
call protagonist_kick_action
call calculate_offset
dec ebx
jmp .calculate_protagonist_kick_brick
;--------------------------------------
@@:
cmp al,ROUTE_RIGHT
jne still
cmp [protagonist_position.x],LEVEL_MAP_SIZE_X-1
je calculate_action_for_all.1 ;still
call protagonist_kick_action
call calculate_offset
inc ebx
;--------------------------------------
.calculate_protagonist_kick_brick:
shl ebx,2
add eax,ebx
add eax,plan_level
mov ebx,[eax]
; cmp bh,OBJECT_FINAL_MONSTER ;OBJECT_PROTAGONIST
; jbe .kill
 
cmp bh,OBJECT_WHITE_BRICK
je .white_brick
 
cmp bh,OBJECT_RED_BRICK ; red brick?
jne still
 
and ebx,0x00ff00ff
add ebx,0x01000000 + RED_BRICK_CRASH_1 shl 8 ; reb brick crash 1
mov [eax],ebx
push eax ebx
; DEBUGF 1, "80 - reb brick crash 10\n"
call show_tiles_one_iteration
mcall 5,5
pop ebx eax
 
and ebx,0x00ff00ff
add ebx,0x01000000 + RED_BRICK_CRASH_2 shl 8 ; reb brick crash 2
mov [eax],ebx
push eax ebx
; DEBUGF 1, "81 - reb brick crash 20\n"
call show_tiles_one_iteration
mcall 5,5
pop ebx eax
 
and ebx,0x00ff00ff
add ebx,0x01000000
mov [eax],ebx
; DEBUGF 1, "81 - reb brick crash 30\n"
; call show_tiles_one_iteration
jmp calculate_action_for_all.2 ;still
;--------------------------------------
;.kill:
; and ebx,0x000000ff
; add ebx,0x01000000
; mov [eax],ebx
;; call show_tiles_one_iteration
; jmp calculate_action_for_all.2
;--------------------------------------
.white_brick:
ror ebx,16
xor bl,bl
mov bh,1
add ebx,[protagonist_route]
rol ebx,16
mov [eax],ebx
jmp calculate_action_for_all.2
;---------------------------------------------------------------------
calculate_action_for_all:
call show_tiles_one_iteration
;--------------------------------------
.1:
call actions_for_all_cell
;--------------------------------------
.2:
call show_tiles_one_iteration
jmp still
;---------------------------------------------------------------------
calculate_offset:
mov eax,[protagonist_position.y]
;--------------------------------------
.1:
imul eax,LEVEL_MAP_SIZE_X*4
mov ebx,[protagonist_position.x]
ret
;---------------------------------------------------------------------
protagonist_kick_action:
call snd_kick_action
add [protagonist_route],4
call show_protagonist_1
sub [protagonist_route],4
call show_protagonist_1
ret
;---------------------------------------------------------------------
calculate_protagonist_vs_brick:
shl ebx,2
add eax,ebx
add eax,plan_level
mov ebx,[eax]
; cmp bh,4 ; brick?
test bh,bh ; empty?
jnz @f
ret
;--------------------------------------
@@:
add esp,4
jmp still
;---------------------------------------------------------------------
show_protagonist_1:
mov ecx,0x01000000 + OBJECT_PROTAGONIST shl 8
call calculate_protagonist_position
; call show_tiles_one_iteration
; call actions_for_all_cell
call show_tiles_one_iteration ;show_tiles
mcall 5,10
ret
;---------------------------------------------------------------------
calculate_protagonist_position:
call calculate_offset
shl ebx,2
add eax,ebx
add eax,plan_level
mov ebx,[eax]
and ebx,0x00ff00ff
add ebx,ecx
mov [eax],ebx
ret
;---------------------------------------------------------------------
/programs/games/rstearth/levels.inc
0,0 → 1,168
;---------------------------------------------------------------------
; cell contents:
; db 1 ; base (background) ; offset +0
; db 80 ; NPC and walls ; offset +1
; db 0 ; route ; offset +2
; db 1 ; 1 - redraw cell, 0 - nothing ; offset +3
 
;---------------------------------------------------------------------
align 4
map_level_game_over:
dd 000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h
dd 000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h
dd 000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h
dd 000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h
dd 000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h
dd 000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h
dd 000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h
dd 000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h
dd 000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h
dd 000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h,000002h
;---------------------------------------------------------------------
align 4
map_level_game_stage:
dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h
dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h
dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h
dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h
dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h
dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h
dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h
dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h
dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h
dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h
;---------------------------------------------------------------------
align 4
map_level_10:
dd 030100h,000000h,000000h,000000h,000000h,000000h,000000h,000000h,000000h,000000h
dd 000000h,001001h,001001h,000001h,000001h,000001h,001001h,001001h,001001h,000000h
dd 010200h,001001h,000002h,000002h,000000h,000000h,000000h,000000h,001001h,000000h
dd 000000h,000001h,000002h,001101h,000001h,000001h,000001h,000000h,001001h,000000h
dd 000000h,000001h,000002h,001101h,000f00h,000000h,000001h,000000h,000001h,000000h
dd 000000h,000001h,000000h,001101h,000000h,000000h,000001h,000000h,000001h,000000h
dd 000000h,000001h,000000h,001001h,001001h,000001h,000001h,001100h,000001h,000000h
dd 000000h,001101h,001100h,000000h,001000h,000000h,000000h,001100h,001101h,000000h
dd 000000h,001101h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000003h
dd 030300h,000000h,000000h,000000h,000000h,020400h,000000h,000000h,000003h,000003h
;---------------------------------------------------------------------
align 4
map_level_1:
dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h
dd 000001h,001001h,001001h,000001h,000001h,000001h,000001h,001101h,001101h,000001h
dd 000001h,001001h,000001h,000001h,000001h,000001h,000001h,000001h,001101h,000001h
dd 000001h,001101h,030101h,001101h,001101h,001001h,001001h,000001h,001001h,000001h
dd 000001h,001101h,000001h,001101h,000f01h,000001h,001001h,000001h,001001h,010301h
dd 000001h,001001h,000001h,001001h,000001h,000001h,001101h,000001h,001101h,000001h
dd 000001h,001001h,000001h,001001h,001001h,001101h,001101h,000001h,001101h,000001h
dd 000001h,001101h,000001h,000001h,000001h,000001h,000001h,000001h,001001h,000001h
dd 000001h,001101h,001101h,000001h,000001h,000001h,000001h,001001h,001001h,000001h
dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h
;---------------------------------------------------------------------
map_level_0:
dd 000000h,000001h,000001h,000001h,001101h,001101h,000001h,000001h,000001h,000000h
dd 000000h,000001h,000001h,001101h,000001h,000001h,001101h,000001h,000001h,000000h
dd 000000h,000001h,001101h,000001h,000001h,000001h,000001h,001101h,000001h,000000h
dd 000000h,001101h,001001h,000001h,000001h,000001h,000001h,001001h,001101h,000000h
dd 000000h,010201h,001001h,000001h,000f01h,000001h,000001h,001001h,000001h,000000h
dd 000000h,000001h,001001h,000001h,000001h,000001h,000001h,001001h,000001h,000000h
dd 000000h,000001h,001001h,000001h,000001h,000001h,000001h,001001h,000001h,000000h
dd 000000h,000001h,001001h,001101h,001101h,001101h,001101h,001001h,000001h,000000h
dd 000000h,000001h,001001h,000001h,000001h,000001h,000001h,001001h,000001h,000000h
dd 000000h,000000h,001000h,000000h,000000h,000000h,000000h,001000h,000000h,020100h
;---------------------------------------------------------------------
map_level_2:
dd 000004h,000004h,001104h,000004h,000004h,000004h,000004h,000004h,000004h,000004h
dd 000004h,000004h,001104h,000004h,000004h,000004h,000004h,000004h,000004h,000004h
dd 000004h,000004h,001104h,000004h,000004h,000004h,000004h,001104h,001104h,001104h
dd 000004h,000004h,001104h,000004h,000004h,000004h,000004h,000004h,000004h,000004h
dd 000004h,000004h,000004h,000004h,000f04h,000004h,000004h,000004h,000004h,000004h
dd 000004h,000004h,000004h,000004h,000004h,000004h,000004h,000004h,000004h,000004h
dd 000004h,000004h,000004h,000004h,000004h,000004h,000004h,001104h,000004h,000004h
dd 001104h,001104h,001104h,000004h,001004h,000004h,000004h,001104h,000004h,000004h
dd 000004h,000004h,000004h,000004h,000004h,001004h,000004h,001104h,000004h,000004h
dd 030304h,000004h,000004h,000004h,000004h,000004h,000004h,001104h,020304h,000004h
;---------------------------------------------------------------------
map_level_3:
dd 000004h,040304h,000004h,000004h,000004h,000004h,000004h,000004h,000004h,000004h
dd 000004h,001104h,000004h,000004h,000004h,001104h,000004h,000004h,000004h,000004h
dd 000004h,001004h,000004h,000004h,000004h,001004h,000004h,000004h,000004h,000004h
dd 000004h,000004h,000004h,000004h,000004h,000004h,000004h,000004h,000004h,000004h
dd 000004h,000004h,001104h,000004h,000f04h,000004h,001104h,000004h,001104h,000004h
dd 000004h,000004h,001004h,000004h,001004h,000004h,001004h,000004h,001004h,000004h
dd 000004h,000004h,000004h,000004h,000004h,000004h,000004h,000004h,000004h,000004h
dd 000004h,000004h,000004h,001104h,000004h,000004h,000004h,001104h,000004h,000004h
dd 000004h,000004h,000004h,001004h,000004h,000004h,000004h,001004h,000004h,000004h
dd 000004h,000004h,000004h,000004h,000004h,010104h,000004h,000004h,000004h,000004h
;---------------------------------------------------------------------
map_level_4:
dd 000005h,000005h,000005h,000005h,000005h,000005h,000005h,030105h,000005h,000005h
dd 000005h,000005h,000005h,000005h,000005h,000005h,000005h,000005h,000005h,000005h
dd 000005h,001105h,000005h,001005h,000005h,001105h,000005h,001005h,000005h,000005h
dd 000005h,001005h,000005h,001105h,000005h,001005h,000005h,001105h,000005h,000005h
dd 000005h,001005h,000005h,001005h,000f05h,001005h,000005h,001005h,000005h,000005h
dd 000005h,000005h,000005h,000005h,000005h,000005h,000005h,000005h,000005h,000005h
dd 000005h,000005h,001005h,000005h,001105h,000005h,001105h,000005h,001005h,000005h
dd 000005h,000005h,001005h,000005h,001005h,000005h,001005h,000005h,001005h,000005h
dd 000005h,000005h,001105h,000005h,001005h,000005h,001105h,000005h,001005h,000005h
dd 000005h,000005h,000005h,010205h,000005h,000005h,000005h,000005h,000005h,000005h
;---------------------------------------------------------------------
map_level_5:
dd 000000h,000000h,000000h,020300h,000000h,000000h,000000h,000000h,000000h,000000h
dd 000000h,000002h,001100h,000000h,000000h,000002h,001100h,000000h,001100h,000000h
dd 000000h,000002h,000000h,000000h,000000h,000002h,000003h,000000h,000000h,000000h
dd 000000h,000000h,000000h,000000h,000000h,000000h,000003h,000000h,000000h,000000h
dd 000000h,000000h,001100h,000000h,000f00h,000000h,000003h,000000h,000000h,000000h
dd 040100h,000000h,000000h,000000h,000000h,000000h,000000h,000000h,001100h,000000h
dd 000000h,001100h,000000h,000000h,000000h,000000h,000000h,000000h,000003h,000000h
dd 000000h,000003h,000000h,000002h,001100h,000000h,001100h,000000h,000003h,000000h
dd 000000h,000003h,000000h,000002h,000000h,000000h,000000h,000000h,000003h,000000h
dd 000000h,000000h,000000h,000000h,000000h,000000h,000000h,000000h,000000h,030400h
;---------------------------------------------------------------------
map_level_6:
dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,030401h
dd 000001h,000003h,000003h,000003h,000001h,000001h,000003h,000003h,000001h,000001h
dd 000001h,000001h,001101h,000001h,000001h,001101h,000001h,001101h,000001h,000001h
dd 040401h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h
dd 000001h,000001h,000003h,000003h,000f01h,000001h,000003h,000003h,000001h,001101h
dd 000001h,000001h,000001h,000001h,001101h,000001h,000001h,000001h,000001h,000001h
dd 000001h,001101h,001101h,000001h,000001h,001101h,000001h,000001h,001001h,000001h
dd 000001h,001001h,001001h,000001h,000003h,000003h,000003h,000001h,001101h,000001h
dd 000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h,000001h
dd 000001h,000001h,000001h,000001h,000001h,040401h,000001h,000001h,000001h,000001h
;---------------------------------------------------------------------
map_level_7:
dd 000004h,000004h,000004h,000004h,000004h,000004h,000004h,000004h,000004h,000004h
dd 000004h,001104h,000004h,001104h,000004h,000004h,001104h,000004h,000004h,000004h
dd 000004h,000002h,040104h,000004h,000004h,000002h,000002h,001104h,000004h,000004h
dd 000004h,000002h,000004h,001104h,000004h,000004h,000002h,000004h,000004h,000004h
dd 000004h,000002h,000004h,000004h,000f04h,000004h,000002h,000004h,001104h,000004h
dd 000004h,000004h,000002h,000004h,000004h,000004h,000004h,000004h,001104h,000004h
dd 000004h,001104h,000002h,000002h,000004h,000004h,000004h,000004h,030204h,000004h
dd 000004h,000004h,000004h,001104h,000004h,000004h,001104h,000004h,000002h,000004h
dd 000004h,000004h,000004h,000004h,000004h,000002h,000002h,000002h,000004h,000004h
dd 040304h,000004h,000004h,000004h,000004h,000004h,000004h,000004h,000004h,000004h
;---------------------------------------------------------------------
map_level_8:
dd 040400h,000000h,000000h,000000h,000000h,000000h,000000h,000000h,000000h,000000h
dd 000000h,000003h,000003h,000000h,000000h,001100h,001100h,000000h,001100h,000000h
dd 000000h,000003h,000003h,000000h,000000h,000000h,000000h,000000h,000003h,000000h
dd 000000h,001100h,000000h,000000h,000000h,000000h,000000h,000003h,000003h,000000h
dd 000000h,001000h,000000h,000003h,000f00h,000000h,001100h,000003h,000000h,000000h
dd 000000h,001100h,000000h,000003h,000003h,000000h,000000h,000000h,000000h,030200h
dd 000000h,000000h,000000h,001100h,000000h,000000h,000000h,000000h,000000h,000000h
dd 000000h,000000h,001000h,001100h,000000h,000000h,000003h,000000h,001100h,000000h
dd 000000h,000000h,001100h,000000h,000000h,000000h,000003h,000003h,001000h,000000h
dd 000000h,000000h,000000h,000000h,000000h,010100h,000000h,000000h,000000h,000000h
;---------------------------------------------------------------------
map_level_9:
dd 040205h,000005h,000005h,000005h,001105h,000005h,000005h,000005h,001105h,000005h
dd 000005h,001105h,000005h,000005h,000005h,000005h,000005h,000005h,000005h,000005h
dd 000005h,000002h,000005h,000002h,000005h,000002h,000005h,000002h,000005h,000005h
dd 000005h,000005h,000005h,000005h,001105h,000005h,000005h,000005h,001105h,000005h
dd 000005h,000005h,000002h,000005h,000f05h,000005h,000002h,000005h,000002h,000005h
dd 000005h,001105h,000005h,000005h,000005h,000005h,000005h,030305h,000005h,000005h
dd 000005h,000002h,000005h,000002h,000005h,000002h,000005h,000002h,000005h,000005h
dd 000005h,000005h,000005h,001105h,000005h,000005h,000005h,001105h,001105h,000005h
dd 000005h,000005h,000005h,000005h,001105h,000005h,000005h,000005h,000005h,000005h
dd 000005h,000005h,010105h,000005h,000005h,000005h,000005h,000005h,000005h,000005h
;---------------------------------------------------------------------
/programs/games/rstearth/resources/base_8bpp.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/rstearth/resources/misc_menu.wav
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/rstearth/resources/font_russo_1bpp.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/rstearth/resources/barret_8bpp.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/rstearth/resources/death_8bpp.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/rstearth/resources/flaunch.wav
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/rstearth/resources/ifrit_8bpp.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/rstearth/resources/miku_8bpp.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/rstearth/resources/red_brick_8bpp.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/rstearth/resources/skeleton_8bpp.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/rstearth/resources/walking_with_poseidon.wav
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/rstearth/resources/white_brick_8bpp.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/programs/games/rstearth/resources
Property changes:
Added: tsvn:logminsize
+5
\ No newline at end of property
/programs/games/rstearth/rstearth.asm
0,0 → 1,343
;*****************************************************************************
; Rusty Earth - for Kolibri OS
; Copyright (c) 2014, Marat Zakiyanov aka Mario79, aka Mario
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; * Neither the name of the <organization> nor the
; names of its contributors may be used to endorse or promote products
; derived from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;*****************************************************************************
use32
org 0x0
 
db 'MENUET01'
dd 0x01
dd START
dd IM_END
dd I_END
dd stacktop
dd bootparam
dd path
;-----------------------------------------------------------------------------
include 'lang.inc'
include '../../macros.inc'
include '../../proc32.inc'
;define __DEBUG__ 1
;define __DEBUG_LEVEL__ 1
;include '../../debug-fdo.inc'
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
SPRITE_SIZE_Y = 64
;-----------------------------------------------------------------------------
ROUTE_UP = 1
ROUTE_DOWN = 2
ROUTE_LEFT = 3
ROUTE_RIGHT = 4
;-----------------------------------------------------------------------------
OBJECT_DEATH = 1
OBJECT_SKELETON = 2
OBJECT_IFRIT = 3
OBJECT_BARRET = 4
OBJECT_FINAL_MONSTER = 14 ; 0Eh
OBJECT_PROTAGONIST = 15 ; 0Fh
OBJECT_RED_BRICK = 16 ; 10h
OBJECT_WHITE_BRICK = 17 ; 11h
RED_BRICK_CRASH_1 = 0x80
RED_BRICK_CRASH_2 = 0x81
;-----------------------------------------------------------------------------
BASE_SMALL_ROCK = 0
BASE_GRASS = 1
BASE_LAVA = 2
BASE_WATER = 3
BASE_SAND = 4
BASE_SNOW = 5
;-----------------------------------------------------------------------------
TARGET_RANGE = 3
;-----------------------------------------------------------------------------
START:
mcall 68,11
mcall 66,1,1
mcall 40,0x7 ;27
;--------------------------------------
load_libraries l_libs_start,end_l_libs
test eax,eax
jnz button.exit
;--------------------------------------
; unpack deflate
mov eax,[unpack_DeflateUnpack2]
mov [deflate_unpack],eax
;--------------------------------------
call load_and_convert_all_icons
cmp [bootparam],dword 'NOSO'
je menu_still
 
call load_all_sound_files
mov eax,[background_music]
mov [wav_for_test],eax
mov ebx,eax
add ebx,1024
mov [wav_for_test_end],ebx
call test_wav_file
mov [music_flag],1
mcall 51,1,snd_background_music_thread_start,snd_background_music_thread_stack
mov [sounds_flag],1
mcall 51,1,snd_kick_action_thread_start,snd_kick_action_thread_stack
;---------------------------------------------------------------------
menu_still:
jmp main_menu_start
;---------------------------------------------------------------------
show_game_stage:
mov esi,map_level_game_stage
call map_level_to_plan_level
call draw_window
mov eax,[level_counter]
inc eax
mov ebx,stage_text.1
call decimal_string_2
mov edx,stage_text
mov ebx,SPRITE_SIZE_X*3 shl 16 + SPRITE_SIZE_Y*5
call draw_font
mcall 5,300
ret
;---------------------------------------------------------------------
show_game_win:
mov esi,map_level_game_stage
call map_level_to_plan_level
call draw_window
mov edx,game_win_text
mov ebx,SPRITE_SIZE_X*2 shl 16 + SPRITE_SIZE_Y*5
call draw_font
mcall 5,1000
ret
;---------------------------------------------------------------------
death_of_protagonist_show:
mov esi,map_level_game_over
call map_level_to_plan_level
call draw_window
mov edx,protagonist_death_text
mov ebx,SPRITE_SIZE_X*2 shl 16 + SPRITE_SIZE_Y*5
call draw_font
mcall 5,500
jmp main_menu_start
;---------------------------------------------------------------------
start_level_0:
xor eax,eax
mov [level_counter],eax
;---------------------------------------------------------------------
start_level:
mov esi,[level_counter]
shl esi,2
mov esi,[esi+map_level_pointer]
test esi,esi
jnz @f
call show_game_win
jmp main_menu_start
;--------------------------------------
@@:
call show_game_stage
mov eax,[stone_kick_sound]
mov [sounds_sample],eax
; xor eax,eax
; mov [level_counter],eax
mov [death_of_protagonist],0
mov [protagonist_route],2
mov [protagonist_position.x],4
mov [protagonist_position.y],4
mov esi,[level_counter]
shl esi,2
mov esi,[esi+map_level_pointer]
; mov esi,map_level_0
call map_level_to_plan_level
call generate_objects_id
call copy_plan_level_to_plan_level_old
;---------------------------------------------------------------------
red:
call draw_window
;---------------------------------------------------------------------
still:
; mcall 10
mcall 23,1
 
cmp eax,1
je red
 
cmp eax,2
je key
 
cmp eax,3
je button
call actions_for_all_cell
call show_tiles
call harvest_of_death
call show_tiles_one_iteration
cmp [death_of_protagonist],1
je death_of_protagonist_show
cmp [npc_alive],0
jne @f
 
inc byte [level_counter]
jmp start_level
;--------------------------------------
@@:
mov eax,[protagonist_position.y]
imul eax,LEVEL_MAP_SIZE_X*4
mov ebx,[protagonist_position.x]
shl ebx,2
add eax,ebx
add eax,plan_level
mov eax,[eax]
cmp ah,OBJECT_PROTAGONIST
jne death_of_protagonist_show
 
jmp still
;---------------------------------------------------------------------
button:
mcall 17
 
cmp ah,1
jne still
;--------------------------------------
.exit:
mov eax,[N_error]
; DEBUGF 1, "N_error: %d\n",eax
test eax,eax
jz @f
 
mcall 51,1,thread_start,thread_stack
;--------------------------------------
@@:
mov [music_flag],2
mov [sounds_flag],2
mcall -1
;---------------------------------------------------------------------
draw_window:
mcall 12,1
mcall 48,4
mov ecx,100 shl 16 + 644
add cx,ax
mcall 0,<100,649>,,0x74AABBCC,,title
; mcall 13,<0,640>,<0,640>,0xff0000
mov [draw_all_level],1
; call show_tiles
call show_tiles_one_iteration
mov [draw_all_level],0
; mcall 4,<3,8>,0,message,message.size
mcall 12,2
ret
;---------------------------------------------------------------------
; ……‚Ž„ 10-›• —ˆ‘…‹ ‘Ž ‡€ŠŽŒ ‚ ‘’ŽŠŽ‚›‰ ‚ˆ„
; ‚室:
; AX - ç¨á«®
; EBX -  ¤à¥á áâப¨
; ‚ë室:
; áâப  ᮤ¥à¦¨â ç¨á«®, ª®­¥æ ®â¬¥ç¥­ ª®¤®¬ 0
;------------------------------------------------------------------------------
decimal_string_2:
push eax ebx ecx edx
xor ecx,ecx
mov [ebx],byte '0'
inc ebx
;--------------------------------------
.p3:
xor edx,edx
push ebx
mov ebx,10
div ebx
pop ebx
add edx,48
push edx
inc ecx
cmp ax,0
jne .p3
 
cmp ecx,1
jbe .p4
 
mov ecx,2
dec ebx
;--------------------------------------
.p4:
pop edx
mov [ebx],dl
inc ebx
loop .p4
pop edx ecx ebx eax
ret
;------------------------------------------------------------------------------
;---------------------------------------------------------------------
memory_free_error:
mov [N_error],3
jmp button.exit
;---------------------------------------------------------------------
memory_get_error:
mov [N_error],4
jmp button.exit
;-----------------------------------------------------------------------------
include 'key.inc'
include 'show_tiles.inc'
include 'show_base.inc'
include 'show_object.inc'
include 'load.inc'
include 'icon_convert.inc'
include 'error_window.inc'
include 'actions.inc'
include 'actions_npc.inc'
include 'actions_protagonist.inc'
include 'actions_white_bricks.inc'
include 'random.inc'
include 'snd_api.inc'
include 'sound.inc'
include 'menu.inc'
include 'font.inc'
;---------------------------------------------------------------------
if lang eq ru
include 'localization_rus.inc'
else
include 'localization_eng.inc'
end if
;---------------------------------------------------------------------
include 'i_data.inc'
include 'levels.inc'
;---------------------------------------------------------------------
IM_END:
;---------------------------------------------------------------------
;include_debug_strings
;---------------------------------------------------------------------
include 'u_data.inc'
;---------------------------------------------------------------------
I_END:
/programs/games/rstearth/actions.inc
0,0 → 1,157
;---------------------------------------------------------------------
actions_for_all_cell:
;; DEBUGF 1, "actions_for_all\n"
; set start coordinates
mov ebx,LEVEL_MAP_SIZE_Y
mov ecx,plan_level+(LEVEL_MAP_SIZE_Y*LEVEL_MAP_SIZE_X*4)-4
;--------------------------------------
.new_y:
mov eax,LEVEL_MAP_SIZE_X
;--------------------------------------
.new_x:
push eax ebx ecx
mov [action_cell_x],eax
mov [action_cell_y],ebx
mov edx,[ecx]
mov [current_cell_NPC],dh
test dh,dh ; empty
jz .end_processing_sell
; mov ebp,ecx
; sub ebp,plan_level
; DEBUGF 1, "Y : %x X: %x cell: %x ebp: %x\n",ebx,eax,edx,ebp
ror edx,16
test dh,dh
jnz .end_processing_sell
 
test dl,dl
jz .end_processing_sell
 
; call processing_NPC_route
; DEBUGF 1, "new cell: %x\n",edx
 
cmp [current_cell_NPC],OBJECT_FINAL_MONSTER
ja @f
call processing_npc_action
jmp .end_processing_sell
;--------------------------------------
@@:
cmp [current_cell_NPC],OBJECT_PROTAGONIST
jne @f
call processing_protagonist_action
jmp .end_processing_sell
;--------------------------------------
@@:
cmp [current_cell_NPC],OBJECT_WHITE_BRICK
jne .end_processing_sell
call processing_white_brick
;--------------------------------------
.end_processing_sell:
pop ecx ebx eax
sub ecx,4
dec eax
jnz .new_x
dec ebx
jnz .new_y
;; DEBUGF 1, "actions_for_all END\n"
ret
;---------------------------------------------------------------------
action_stop:
; DEBUGF 1, "action_stop\n"
mov dx,0x0100
rol edx,16
mov [ecx],edx
ret
;---------------------------------------------------------------------
object_death:
mov dx,0x01
shl edx,24
mov [ecx],edx
ret
;---------------------------------------------------------------------
save_route_to_current_position:
ror eax,16
mov ax,si
rol eax,16
rol edx,16
mov ax,dx
mov [ecx],eax ; new route for unit
ret
;---------------------------------------------------------------------
save_new_and_clear_old_position:
; DEBUGF 1, "save_new_and_clear_old_position\n"
ror eax,16
mov ax,si
rol eax,16
rol edx,16
mov ah,dh
mov [edi],eax ; new cell for unit
and edx,0xff
add edx,0x01000000 ; clear old cell and show
mov [ecx],edx
; copy object id
mov eax,[ecx+LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4]
mov [edi+LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4],eax
xor eax,eax
mov [ecx+LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4],eax
ret
;---------------------------------------------------------------------
harvest_of_death:
xor eax,eax
mov [death_of_protagonist],al
mov [npc_alive],al
mov esi,plan_level
mov ecx,LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y
cld
;--------------------------------------
.loop:
lodsd
test ah,ah
jz .counter
 
cmp al,BASE_LAVA
je .base_lava
cmp al,BASE_WATER
je .base_water
cmp ah,OBJECT_FINAL_MONSTER
ja .counter
mov [npc_alive],1
;--------------------------------------
.counter:
dec ecx
jnz .loop
ret
;--------------------------------------
.base_water:
cmp ah,OBJECT_PROTAGONIST
jne .kill_object
;--------------------------------------
.kill_protagonist:
mov [death_of_protagonist],1
jmp .kill_object
;--------------------------------------
.base_lava:
cmp ah,OBJECT_PROTAGONIST
je .kill_protagonist
 
cmp ah,OBJECT_SKELETON
ja .counter
;--------------------------------------
.kill_object:
; DEBUGF 1, "kill_object\n"
and eax,0x000000ff
add eax,0x01000000
mov [esi-4],eax
xor eax,eax
mov [esi-4-plan_level+objects_id],eax
jmp .counter
;---------------------------------------------------------------------
/programs/games/rstearth/font.inc
0,0 → 1,38
;---------------------------------------------------------------------
draw_font:
; in:
; ebx - X*65536 + Y
; edx - text ASCII
;
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
;---------------------------------------------------------------------
/programs/games/rstearth/u_data.inc
0,0 → 1,145
;---------------------------------------------------------------------
; uninitialized data
;---------------------------------------------------------------------
extended_key rb 1
draw_all_level rb 1
current_cell_NPC rb 1
death_of_protagonist rb 1
npc_alive rb 1
target_detected rb 1
sound_flag rb 1
sounds_flag rb 1
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
init_sound_busy_flag 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
npc_miku_icons rd 1
npc_death_icons rd 1
npc_skeleton_icons rd 1
npc_ifrit_icons rd 1
npc_barret_icons rd 1
;---------------------------------------------------------------------
background_music rd 1
sounds_sample rd 1
 
stone_kick_sound rd 1
menu_sound rd 1
;---------------------------------------------------------------------
show_tiles_iterations rd 1
characters_offset_x rd 1
characters_offset_y rd 1
characters_size_x rd 1
characters_size_y rd 1
buffer_offset_x rd 1
buffer_offset_y rd 1
;---------------------------------------------------------------------
action_cell_x rd 1
action_cell_y rd 1
target_action_cell_x rd 1
target_action_cell_y rd 1
;------------------------------------------------------------------------------
menu_text_pointers rd 1
text_step_Y rd 1
;------------------------------------------------------------------------------
level_counter rd 1
;------------------------------------------------------------------------------
align 4
version rd 1 ; версия интерфейса, текущая 0x0101
; snd_format одна из констант вида PCM_X_Y_Z где
; X- число каналов
; Y- разрядность в битах на канал
; Z- частота в КГц из фикс. набора 11025Гц, 12000Гц, 16000Гц, 22050Гц, 24000Гц, 32000Гц, 44100Гц, 48000Гц
; Если формат не известен заранее используется константа PCM_ALL.
; Окончательно формат устанавливается вызовом SetFormat.
snd_format rd 1 ; формат данных
; хэндл буфера
hBuff_pointer rd 1
hBuff_buffer_size_pointer rd 1
 
hBuff1 rd 1
hBuff2 rd 1
 
hBuff1_buffer_size rd 1
hBuff2_buffer_size rd 1
 
hBuff1_buffer_offset rd 1
hBuff2_buffer_offset rd 1
 
hBuff1_driver_notify_struct rd 6 ; структура события от драйвера
hBuff2_driver_notify_struct rd 6 ; структура события от драйвера
 
data_offset rd 1
;---------------------------------------------------------------------
voice_samples_start rd 1 ; start of *.SMP
wav_for_test rd 1
wav_for_test_end rd 1
;---------------------------------------------------------------------
align 4
buffer_area:
rb 64*64*4 ; 64p * 64p * 32bpp
;---------------------------------------------------------------------
align 4
plan_level:
rb LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4
;---------------------------------------------------------------------
align 4
objects_id:
rb LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4
;---------------------------------------------------------------------
align 4
plan_level_old:
rb LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4
;---------------------------------------------------------------------
align 4
objects_id_old:
rb LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4
;---------------------------------------------------------------------
align 4
path:
rb 4096
;---------------------------------------------------------------------
align 4
file_name:
rb 4096
;---------------------------------------------------------------------
align 4
file_info:
rb 40
;---------------------------------------------------------------------
align 4
bootparam:
;procinfo:
;process_info:
rb 1024
;---------------------------------------------------------------------
align 4
; sound thread
rb 1024
snd_kick_action_thread_stack:
;---------------------------------------------------------------------
align 4
; sound thread
rb 1024
snd_background_music_thread_stack:
;---------------------------------------------------------------------
align 4
; window error message
rb 1024
thread_stack:
;---------------------------------------------------------------------
align 4
rb 1024
stacktop:
;---------------------------------------------------------------------
/programs/games/rstearth/build_en.bat
0,0 → 1,19
if not exist bin mkdir rstearth_eng_bin
@erase lang.inc
@echo lang fix en >lang.inc
@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
@copy resources\miku_8bpp.png rstearth_eng_bin\miku_8bpp.png
@copy resources\death_8bpp.png rstearth_eng_bin\death_8bpp.png
@copy resources\skeleton_8bpp.png rstearth_eng_bin\skeleton_8bpp.png
@copy resources\ifrit_8bpp.png rstearth_eng_bin\ifrit_8bpp.png
@copy resources\barret_8bpp.png rstearth_eng_bin\barret_8bpp.png
@copy resources\walking_with_poseidon.wav rstearth_eng_bin\walking_with_poseidon.wav
@copy resources\flaunch.wav rstearth_eng_bin\flaunch.wav
@copy resources\misc_menu.wav rstearth_eng_bin\misc_menu.wav
@pause
/programs/games/rstearth/build_ru.bat
0,0 → 1,19
if not exist bin mkdir rstearth_rus_bin
@erase lang.inc
@echo lang fix ru >lang.inc
@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
@copy resources\miku_8bpp.png rstearth_rus_bin\miku_8bpp.png
@copy resources\death_8bpp.png rstearth_rus_bin\death_8bpp.png
@copy resources\skeleton_8bpp.png rstearth_rus_bin\skeleton_8bpp.png
@copy resources\ifrit_8bpp.png rstearth_rus_bin\ifrit_8bpp.png
@copy resources\barret_8bpp.png rstearth_rus_bin\barret_8bpp.png
@copy resources\walking_with_poseidon.wav rstearth_rus_bin\walking_with_poseidon.wav
@copy resources\flaunch.wav rstearth_rus_bin\flaunch.wav
@copy resources\misc_menu.wav rstearth_rus_bin\misc_menu.wav
@pause
/programs/games/rstearth/load.inc
0,0 → 1,164
;---------------------------------------------------------------------
load_file:
mov esi,path
mov edi,file_name
call copy_file_path
 
mov [fileinfo.subfunction],dword 5
mov [fileinfo.size],dword 0
mov [fileinfo.return],dword file_info
mcall 70,fileinfo
test eax,eax
jnz .error
 
mov [fileinfo.subfunction],dword 0
 
mov ecx,[file_info+32]
mov [fileinfo.size],ecx
mov [img_size],ecx
mcall 68,12
test eax,eax
jz memory_get_error
 
mov [fileinfo.return],eax
mov [image_file],eax
 
mcall 70,fileinfo
test eax,eax
jnz .error
ret
.error:
mov [N_error],2
mov [error_type],eax
jmp button.exit
;---------------------------------------------------------------------
copy_file_path:
xor eax,eax
cld
@@:
lodsb
stosb
test eax,eax
jnz @b
mov esi,edi
dec esi
std
@@:
lodsb
cmp al,'/'
jnz @b
mov edi,esi
add edi,2
mov esi,ebx
cld
@@:
lodsb
stosb
test eax,eax
jnz @b
ret
;---------------------------------------------------------------------
load_and_convert_current_icon_set:
call load_file
call convert_icons
mov eax,[raw_pointer]
ret
;---------------------------------------------------------------------
; 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
; DEBUGF 1, "npc_miku_kick_icons_file_name: %s\n",npc_miku_kick_icons_file_name
; DEBUGF 1, "size x: %x\n",[eax+4]
; DEBUGF 1, "size x: %x\n",[eax+8]
; DEBUGF 1, "common depth: %x\n",[eax+12]
; DEBUGF 1, "channel depth: %x\n",[eax+16]:2
; DEBUGF 1, "channel value: %x\n",[eax+18]:2
; DEBUGF 1, "palette offset: %x\n",[eax+20]
; DEBUGF 1, "palette size: %x\n",[eax+24]
; DEBUGF 1, "data offset: %x\n",[eax+28]
; 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
call load_and_convert_current_icon_set
mov [red_brick_icons],eax
; DEBUGF 1, "red_brick_icons: %x\n",eax
 
; load and convert white brick
mov ebx,white_brick_icons_file_name
call load_and_convert_current_icon_set
mov [white_brick_icons],eax
; DEBUGF 1, "white_brick_icons: %x\n",eax
 
; load and convert miku
mov ebx,npc_miku_icons_file_name
call load_and_convert_current_icon_set
mov [npc_miku_icons],eax
; DEBUGF 1, "npc_miku_icons: %x\n",eax
 
; load and convert death
mov ebx,npc_death_icons_file_name
call load_and_convert_current_icon_set
mov [npc_death_icons],eax
; DEBUGF 1, "npc_death_icons: %x\n",eax
 
; load and convert skeleton
mov ebx,npc_skeleton_icons_file_name
call load_and_convert_current_icon_set
mov [npc_skeleton_icons],eax
; DEBUGF 1, "npc_skeleton_icons: %x\n",eax
 
; load and convert ifrit
mov ebx,npc_ifrit_icons_file_name
call load_and_convert_current_icon_set
mov [npc_ifrit_icons],eax
; DEBUGF 1, "npc_ifrit_icons: %x\n",eax
 
; load and convert barret
mov ebx,npc_barret_icons_file_name
call load_and_convert_current_icon_set
mov [npc_barret_icons],eax
; DEBUGF 1, "npc_barret_icons: %x\n",eax
 
ret
;---------------------------------------------------------------------
load_sound:
call load_file
mov eax,[fileinfo.return]
ret
;---------------------------------------------------------------------
load_all_sound_files:
; load background music
mov ebx,background_music_file_name
call load_sound
mov [background_music],eax
; load stone kick sound
mov ebx,stone_kick_sound_file_name
call load_sound
mov [stone_kick_sound],eax
; load menu sound
mov ebx,menu_sound_file_name
call load_sound
mov [menu_sound],eax
 
ret
;---------------------------------------------------------------------
/programs/games/rstearth/snd_api.inc
0,0 → 1,545
struc CTRL_INFO
{ .pci_cmd dd ?
.irq dd ?
.glob_cntrl dd ?
.glob_sta dd ?
.codec_io_base dd ?
.ctrl_io_base dd ?
.codec_mem_base dd ?
.ctrl_mem_base dd ?
.codec_id dd ?
}
CTRL_INFO_SIZE equ 9*4
 
SRV_GETVERSION equ 0
SND_CREATE_BUFF equ 1
SND_DESTROY_BUFF equ 2
SND_SETFORMAT equ 3
SND_GETFORMAT equ 4
SND_RESET equ 5
SND_SETPOS equ 6
SND_GETPOS equ 7
SND_SETBUFF equ 8
SND_OUT equ 9
SND_PLAY equ 10
SND_STOP equ 11
SND_SETVOLUME equ 12
SND_GETVOLUME equ 13
SND_SETPAN equ 14
SND_GETPAN equ 15
SND_GETBUFFSIZE equ 16
SND_GETFREESPACE equ 17
SND_SETTIMEBASE equ 18
SND_GETTIMESTAMP equ 19
 
DEV_SET_BUFF equ 4
DEV_NOTIFY equ 5
DEV_SET_MASTERVOL equ 6
DEV_GET_MASTERVOL equ 7
DEV_GET_INFO equ 8
 
SOUND_VERSION equ 0x0101
PCM_ALL equ 0
 
PCM_OUT equ 0x08000000
PCM_RING equ 0x10000000
PCM_STATIC equ 0x20000000
PCM_FLOAT equ 0x40000000
PCM_FILTER equ 0x80000000
 
PCM_2_16_48 equ 1
PCM_1_16_48 equ 2
PCM_2_16_44 equ 3
PCM_1_16_44 equ 4
PCM_2_16_32 equ 5
PCM_1_16_32 equ 6
PCM_2_16_24 equ 7
PCM_1_16_24 equ 8
PCM_2_16_22 equ 9
PCM_1_16_22 equ 10
PCM_2_16_16 equ 11
PCM_1_16_16 equ 12
PCM_2_16_12 equ 13
PCM_1_16_12 equ 14
PCM_2_16_11 equ 15
PCM_1_16_11 equ 16
PCM_2_16_8 equ 17
PCM_1_16_8 equ 18
PCM_2_8_48 equ 19
PCM_1_8_48 equ 20
PCM_2_8_44 equ 21
PCM_1_8_44 equ 22
PCM_2_8_32 equ 23
PCM_1_8_32 equ 24
PCM_2_8_24 equ 25
PCM_1_8_24 equ 26
PCM_2_8_22 equ 27
PCM_1_8_22 equ 28
PCM_2_8_16 equ 29
PCM_1_8_16 equ 30
PCM_2_8_12 equ 31
PCM_1_8_12 equ 32
PCM_2_8_11 equ 33
PCM_1_8_11 equ 34
PCM_2_8_8 equ 35
PCM_1_8_8 equ 36
 
; i_data
szInfinity db 'INFINITY',0
szSound db 'SOUND',0
; u_data
hSound dd ?
hrdwSound dd ?
;------------------------------------------------------------------------------
align 4
_InitSound@4: ;p_ver:dword
push ebx ecx
mcall 68,16,szInfinity
mov [hSound],eax
test eax,eax
jz .fail
mcall 68,16,szSound
mov [hrdwSound],eax
test eax,eax
jz .fail
lea eax,[esp+12] ;p_ver
xor ebx,ebx
push 4 ;.out_size
push eax ;.output
push ebx ;.inp_size
push ebx ;.input
push SRV_GETVERSION ;.code
push [hSound] ;.handle
mov ecx,esp ;[handle]
mcall 68,17
add esp,24
jmp .exit
;--------------------------------------
align 4
.fail:
or eax, -1
;--------------------------------------
align 4
.exit:
pop ecx ebx
ret 4
;------------------------------------------------------------------------------
align 4
_CreateBuffer@12: ;format:dword,size:dword,p_str:dword
push ebx ecx
lea eax,[esp+20] ;p_str
lea ebx,[esp+12] ;format
 
push 4 ;.out_size
push eax ;.output
push 8 ;.inp_size
push ebx ;.input
push SND_CREATE_BUFF;.code
push [hSound] ;.handle
 
mov ecx,esp
mcall 68,17
add esp,24 ;io_cintrol
pop ecx ebx
ret 12
;------------------------------------------------------------------------------
;align 4
;_DestroyBuffer@4: ;str:dword
; push ebx ecx
; xor eax,eax
; lea ebx,[esp+12] ;[stream]
;
; push eax ;.out_size
; push eax ;.output
; push 4 ;.inp_size
; push ebx ;.input
; push SND_DESTROY_BUFF;.code
; push [hSound] ;.handle
;
; mov ecx, esp ;[handle]
; mcall 68,17
; add esp,24
; pop ecx ebx
; ret 4
;------------------------------------------------------------------------------
;align 4
;_WaveOut@12: ;str:dword, src:dword, size:dword
; push ebx ecx
; xor eax,eax
; lea ebx,[esp+12] ;[stream]
;
; push eax ;.out_size
; push eax ;.output
; push 12 ;.inp_size
; push ebx ;.input
; push SND_OUT ;.code
; push dword [hSound] ;.handle
;
; mov ecx,esp
; mcall 68,17
; add esp,24
; pop ecx ebx
; ret 12
;------------------------------------------------------------------------------
align 4
_GetBufferSize@8: ;str:dword, p_size:dword
push ebx ecx
lea eax,[esp+16]
lea ebx,[esp+12] ;[stream]
push 4 ;.out_size
push eax ;.output
push 4 ;.inp_size
push ebx ;.input
push SND_GETBUFFSIZE;.code
push dword [hSound] ;.handle
mov ecx,esp
mcall 68,17
add esp,24
pop ecx ebx
ret 8
;------------------------------------------------------------------------------
;align 4
;_GetBufferFree@8: ;str:dword, p_free:dword
; push ebx ecx
; lea ebx,[esp+12] ;[stream]
; push 0 ;storage for free_space
; mov eax,esp
;
; push 4 ;.out_size
; push eax ;.output
; push 4 ;.inp_size
; push ebx ;.input
; push SND_GETFREESPACE ;.code
; push dword [hSound] ;.handle
;
; mov ecx,esp
; mcall 68,17
; add esp, 24
; mov ecx,[esp+20] ; p_free
; pop dword [ecx]
; pop ecx ebx
; ret 8
;------------------------------------------------------------------------------
align 4
_SetBuffer@16: ;str:dword, src:dword, offs:dword, size:dword
push ebx ecx
xor eax,eax
lea ebx,[esp+12] ;[stream]
 
push eax ;.out_size
push eax ;.output
push 16 ;.inp_size
push ebx ;.input
push SND_SETBUFF ;.code
push dword [hSound] ;.handle
 
mov ecx,esp
mcall 68,17
add esp,24
pop ecx ebx
ret 16
;------------------------------------------------------------------------------
align 4
_PlayBuffer@8: ;str:dword,flags:dword
push ebx ecx
xor eax,eax
lea ebx,[esp+12] ;[stream]
push eax ;.out_size
push eax ;.output
push 8 ;.inp_size
push ebx ;.input
push SND_PLAY ;.code
push dword [hSound] ;.handle
 
mov ecx, esp
mcall 68,17
add esp, 24
pop ecx ebx
ret 8
;------------------------------------------------------------------------------
align 4
_StopBuffer@4: ;str:dword
push ebx ecx
xor eax,eax
lea ebx,[esp+12] ;[stream]
push eax ;.out_size
push eax ;.output
push 4 ;.inp_size
push ebx ;.input
push SND_STOP ;.code
push dword [hSound] ;.handle
mov ecx,esp
mcall 68,17
add esp,24
pop ecx ebx
ret 4
;------------------------------------------------------------------------------
;align 4
;_GetBufferPos@8: ;str:dword, p_pos:dword
; push ebx ecx
; lea eax,[esp+16]
; lea ebx,[esp+12] ;[stream]
;
; push 4 ;.out_size
; push eax ;.output
; push 4 ;.inp_size
; push ebx ;.input
; push SND_GETPOS ;.code
; push dword [hSound] ;.handle
;
; mov ecx,esp
; mcall 68,17
; add esp,24
; pop ecx ebx
; ret 8
;------------------------------------------------------------------------------
;align 4
;_SetBufferPos@8: ;str:dword, offs:dword
; push ebx ecx
; xor eax,eax
; lea ebx,[esp+12] ;[stream]
;
; push eax ;.out_size
; push eax ;.output
; push 8 ;.inp_size
; push ebx ;.input
; push SND_SETPOS ;.code
; push dword [hSound] ;.handle
;
; mov ecx,esp
; mcall 68,17
; add esp,24
; pop ecx ebx
; ret 8
;------------------------------------------------------------------------------
align 4
proc _test_wav@4 stdcall, hdr:dword
mov eax,[hdr]
cmp dword [eax],0x46464952
jne .fail
cmp dword [eax+8],0x45564157
jne .fail
cmp word [eax+20],1
jne .fail
mov ecx,dword [eax+24]
mov edx,22050
cmp ecx,edx
ja .high
je .l_22
cmp ecx,8000
je .l_8
cmp ecx,11025
je .l_11
cmp ecx,12000
je .l_12
cmp ecx,16000
je .l_16
;--------------------------------------
align 4
.fail:
xor eax,eax
ret
;--------------------------------------
align 4
.high:
cmp ecx,24000
je .LN56
 
cmp ecx,32000
je .LN65
 
cmp ecx,44100
je .LN74
 
cmp ecx,48000
jne .fail
movzx ecx,word [eax+22]
dec ecx
je .LN79
 
dec ecx
jne .LN74
mov edx,19
jmp .done
;--------------------------------------
align 4
.LN79:
mov edx,20
jmp .done
;--------------------------------------
align 4
.LN74:
movzx ecx,word [eax+22]
dec ecx
je .LN70
 
dec ecx
jne .LN65
mov edx,21
jmp .done
;--------------------------------------
align 4
.LN70:
mov edx,22
jmp .done
;--------------------------------------
align 4
.LN65:
movzx ecx,word [eax+22]
dec ecx
je .LN61
 
dec ecx
jne .LN56
mov edx,23
jmp .done
;--------------------------------------
align 4
.LN61:
mov edx,24
jmp .done
;--------------------------------------
align 4
.LN56:
movzx ecx,word [eax+22]
dec ecx
je .LN52
 
dec ecx
je .LN50
;--------------------------------------
align 4
.l_22:
movzx ecx,word [eax+22]
dec ecx
je .LN43
 
dec ecx
je .LN41
;--------------------------------------
align 4
.l_16:
movzx ecx,word [eax+22]
dec ecx
je .LN34
 
dec ecx
je .LN32
;--------------------------------------
align 4
.l_12:
movzx ecx,word [eax+22]
dec ecx
je .LN25
 
dec ecx
je .LN23
;--------------------------------------
align 4
.l_11:
movzx ecx,word [eax+22]
dec ecx
je .LN16
 
dec ecx
je .LN14
;--------------------------------------
align 4
.l_8:
movzx ecx,word [eax+22]
dec ecx
je .LN7
 
dec ecx
jne .fail
mov edx,35
jmp .done
;--------------------------------------
align 4
.LN7:
mov edx,36
jmp .done
;--------------------------------------
align 4
.LN14:
mov edx,33
jmp .done
;--------------------------------------
align 4
.LN16:
mov edx,34
jmp .done
;--------------------------------------
align 4
.LN23:
mov edx,31
jmp .done
;--------------------------------------
align 4
.LN25:
mov edx,32
jmp .done
;--------------------------------------
align 4
.LN32:
mov edx,29
jmp .done
;--------------------------------------
align 4
.LN34:
mov edx,30
jmp .done
;--------------------------------------
align 4
.LN41:
mov edx,27
jmp .done
;--------------------------------------
align 4
.LN43:
mov edx,28
jmp .done
;--------------------------------------
align 4
.LN50:
mov edx,25
jmp .done
;--------------------------------------
align 4
.LN52:
mov edx,26
;--------------------------------------
align 4
.done:
xor ecx,ecx
cmp word [eax+34],16
setne cl
dec ecx
and ecx,-18
add ecx,edx
mov eax,ecx
ret
endp
;------------------------------------------------------------------------------
/programs/games/rstearth/sound.inc
0,0 → 1,340
;------------------------------------------------------------------------------
test_wav_file:
mov [sound_flag],1
stdcall _test_wav@4,dword [wav_for_test] ;letter_1a
test eax,eax
jz snd_test_wav_fail
; or eax,PCM_OUT
or eax,PCM_RING
mov [snd_format],eax
 
; DEBUGF 1, "Test wav successful %x\n",eax
 
call find_data_offset
mov al,[sound_flag]
test al,al
jnz .exit
mov [sound_flag],2 ; close thread
;--------------------------------------
.exit:
ret
;------------------------------------------------------------------------------
check_init_sound_busy:
cmp [init_sound_busy_flag],1
jne @f
mcall 5,1
mcall 68,1
jmp check_init_sound_busy
;--------------------------------------
@@:
mov [init_sound_busy_flag],1
ret
;------------------------------------------------------------------------------
initialize_sound_system:
cmp [sound_flag],1
jne sound_exit
 
stdcall _InitSound@4,version
test eax,eax
jnz snd_init_fail
; DEBUGF 1, "Sound init successful %x\n",eax
 
mov eax,[version]
and eax,0xffff
cmp eax,SOUND_VERSION
jne snd_version_fail
 
; DEBUGF 1, "Sound version successful %x\n",eax
;--------------------------------------
stdcall _CreateBuffer@12,[snd_format],0,[hBuff_pointer]
test eax,eax
jnz snd_create_buffer_fail
; DEBUGF 1, "Create Buffer successful %x\n",eax
mov eax,[hBuff_pointer]
mov ebx,[hBuff_buffer_size_pointer]
stdcall _GetBufferSize@8,[eax],ebx ;hBuff1_buffer_size
test eax,eax
jnz snd_get_buffer_size_fail
mov ebx,[hBuff_buffer_size_pointer]
mov eax,[ebx]
; DEBUGF 1, "Get Buffer size successful size: %x\n",eax
shr eax,1
mov [ebx],eax
mov [init_sound_busy_flag],0
ret
;------------------------------------------------------------------------------
sound_exit:
mcall -1
;------------------------------------------------------------------------------
find_data_offset:
mov esi,[wav_for_test]
;--------------------------------------
@@:
cmp [esi],dword 'data'
je @f
 
inc esi
cmp esi,[wav_for_test_end]
jne @b
; DEBUGF 1, "find data offset fail\n"
mov [sound_flag],0
ret
;--------------------------------------
@@:
sub esi,[wav_for_test]
add esi,4
mov [data_offset],esi
ret
;------------------------------------------------------------------------------
snd_test_wav_fail:
; DEBUGF 1, "Test wav fail %x\n",eax
mov [sound_flag],0
ret
;------------------------------------------------------------------------------
snd_init_fail:
; DEBUGF 1, "Sound init fail %x\n",eax
jmp disable_sound
;------------------------------------------------------------------------------
snd_version_fail:
; DEBUGF 1, "Sound version fail %x\n",eax
jmp disable_sound
;------------------------------------------------------------------------------
snd_create_buffer_fail:
; DEBUGF 1, "Create Buffer fail %x\n",eax
jmp disable_sound
;------------------------------------------------------------------------------
snd_get_buffer_size_fail:
; DEBUGF 1, "Get Buffer size fail %x\n",eax
jmp disable_sound
;------------------------------------------------------------------------------
snd_play_buffer_fail:
; DEBUGF 1, "Play Buffer fail\n"
jmp disable_sound
;------------------------------------------------------------------------------
snd_set_buffer_fail:
; DEBUGF 1, "Set Buffer fail\n"
jmp disable_sound
;------------------------------------------------------------------------------
disable_sound:
mov [sound_flag],0
jmp sound_exit
;------------------------------------------------------------------------------
snd_background_music_thread_start:
call check_init_sound_busy
; DEBUGF 1, "snd_background_music_thread_start\n"
mov [hBuff_pointer], dword hBuff1
mov [hBuff_buffer_size_pointer], dword hBuff1_buffer_size
call initialize_sound_system
;--------------------------------------
.1:
cmp [music_flag],2
je sound_exit
 
cmp [music_flag],1
je .start
.2:
mcall 5,1
mcall 68,1
jmp .1
;--------------------------------------
.start:
cmp [init_sound_busy_flag],1
je .2
 
; DEBUGF 1, "background_music Play Buffer start\n",eax
stdcall _PlayBuffer@8, [hBuff1], 0
test eax,eax
jnz snd_play_buffer_fail
; DEBUGF 1, "background_music Play Buffer successful EAX: %x\n",eax
;--------------------------------------
.start_1:
mov eax,[background_music]
; check for correct data_offset
push eax
add eax,[data_offset]
sub eax,4
cmp [eax],dword 'data'
pop eax
je @f
 
mov [wav_for_test],eax
mov ebx,eax
add ebx,1024
mov [wav_for_test_end],ebx
call find_data_offset
cmp [sound_flag],0
jz .1
;--------------------------------------
@@:
add eax,[data_offset]
mov ebx,[eax]
add eax,4
mov ebp,eax
add ebx,eax
; DEBUGF 1, "start EAX: %x\n",eax
;--------------------------------------
.loop:
cmp [music_flag],1
je @f
 
stdcall _StopBuffer@4, [hBuff1]
; DEBUGF 1, "Stop Buffer EAX: %x\n",eax
jmp .1
;--------------------------------------
@@:
; get event data from the driver
; DEBUGF 1, "Get driver_notify_struct \n"
push ebx
mcall 68,14,hBuff1_driver_notify_struct
pop ebx
; DEBUGF 1, "Check to code \n"
; check to code
cmp [hBuff1_driver_notify_struct], dword 0xFF000001
jne @b
; DEBUGF 1, "Check to stream \n"
; check to stream
mov eax,[hBuff1_driver_notify_struct+8]
cmp eax,[hBuff1]
jne @b
; DEBUGF 1, "Get buffer_offset \n"
; get buffer_offset
mov eax,[hBuff1_driver_notify_struct+12]
mov [hBuff1_buffer_offset],eax
; DEBUGF 1, "src EBP: %x size EBX: %x\n",ebp,ebx
stdcall _SetBuffer@16, [hBuff1], ebp, [hBuff1_buffer_offset], [hBuff1_buffer_size]
test eax,eax
jnz snd_set_buffer_fail
; DEBUGF 1, "Set Buffer successful EAX: %x\n",eax
add ebp,[hBuff1_buffer_size]
add ebp,[hBuff1_buffer_size]
cmp ebx,ebp
jbe .start_1
sub ebp,[hBuff1_buffer_size]
jmp .loop
;------------------------------------------------------------------------------
snd_kick_action:
cmp [sounds_flag],1
jne @f
 
cmp [snd_kick_flag],1
je @f
 
mov [snd_kick_flag],1
;--------------------------------------
@@:
ret
;------------------------------------------------------------------------------
snd_kick_action_thread_start:
call check_init_sound_busy
; DEBUGF 1, "snd_kick_action_thread_start\n"
mov [hBuff_pointer], dword hBuff2
mov [hBuff_buffer_size_pointer], dword hBuff2_buffer_size
call initialize_sound_system
;--------------------------------------
.1:
cmp [sounds_flag],2
je sound_exit
 
cmp [sounds_flag],0
je @f
cmp [snd_kick_flag],1
je .start
;--------------------------------------
@@:
mcall 5,1
mcall 68,1
jmp .1
;--------------------------------------
.start:
; DEBUGF 1, "kick_action Play Buffer start\n"
stdcall _PlayBuffer@8, [hBuff2], 0
test eax,eax
jnz snd_play_buffer_fail
; DEBUGF 1, "kick_action Play Buffer successful EAX: %x\n",eax
 
mov eax,[sounds_sample] ;[stone_kick_sound]
; check for correct data_offset
push eax
add eax,[data_offset]
sub eax,4
cmp [eax],dword 'data'
pop eax
je @f
 
mov [wav_for_test],eax
mov ebx,eax
add ebx,1024
mov [wav_for_test_end],ebx
call find_data_offset
cmp [sound_flag],0
jz .1
;--------------------------------------
@@:
add eax,[data_offset]
mov ebx,[eax]
add eax,4
mov ebp,eax
add ebx,eax
; DEBUGF 1, "start EAX: %x\n",eax
;--------------------------------------
.loop:
cmp [sounds_flag],1
je @f
 
stdcall _StopBuffer@4, [hBuff2]
; DEBUGF 1, "Stop Buffer EAX: %x\n",eax
jmp .1
;--------------------------------------
@@:
; get event data from the driver
; DEBUGF 1, "Get driver_notify_struct \n"
push ebx
mcall 68,14,hBuff2_driver_notify_struct
pop ebx
; DEBUGF 1, "Check to code \n"
; check to code
cmp [hBuff2_driver_notify_struct], dword 0xFF000001
jne @b
; DEBUGF 1, "Check to stream \n"
; check to stream
mov eax,[hBuff2_driver_notify_struct+8]
cmp eax,[hBuff2]
jne @b
; DEBUGF 1, "Get buffer_offset \n"
; get buffer_offset
mov eax,[hBuff2_driver_notify_struct+12]
mov [hBuff2_buffer_offset],eax
; DEBUGF 1, "src EBP: %x size EBX: %x\n",ebp,ebx
stdcall _SetBuffer@16, [hBuff2], ebp, [hBuff2_buffer_offset], [hBuff2_buffer_size]
test eax,eax
jnz snd_set_buffer_fail
; DEBUGF 1, "Set Buffer successful EAX: %x\n",eax
add ebp,[hBuff2_buffer_size]
add ebp,[hBuff2_buffer_size]
cmp ebx,ebp
jbe .exit
sub ebp,[hBuff2_buffer_size]
jmp .loop
;--------------------------------------
.exit:
stdcall _StopBuffer@4, [hBuff2]
mov [snd_kick_flag],0
jmp .1
;------------------------------------------------------------------------------
/programs/games/rstearth/Tupfile.lua
0,0 → 1,3
if tup.getconfig("NO_FASM") ~= "" then return end
tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en" or tup.getconfig("LANG")) .. " > lang.inc", {"lang.inc"})
tup.rule({"rstearth.asm", extra_inputs = {"lang.inc"}}, "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "rstearth")
/programs/games/rstearth/actions_npc.inc
0,0 → 1,401
;---------------------------------------------------------------------
processing_npc_action:
; DEBUGF 1, "processing_npc_action\n"
cmp dl,ROUTE_UP
je npc_route_up
 
cmp dl,ROUTE_DOWN
je npc_route_down
 
cmp dl,ROUTE_LEFT
je npc_route_left
 
cmp dl,ROUTE_RIGHT
je npc_route_right
 
ret
;---------------------------------------------------------------------
npc_route_up:
; DEBUGF 1, "npc route_up\n"
cmp ebx,1 ; border of map?
jne @f
;--------------------------------------
.change_route:
; DEBUGF 1, "npc .change_route_up\n"
mov dx,0x0100+ROUTE_RIGHT
call get_random_binary
test al,al
jz .save_new_route
 
mov dx,0x0100+ROUTE_DOWN
;--------------------------------------
.save_new_route:
rol edx,16
mov [ecx],edx
ret
;--------------------------------------
@@:
; DEBUGF 1, "npc up @@:\n"
call npc_search_target_up_left
cmp [target_detected],1
jne @f
mov edi,TARGET_RANGE
sub edi,[target_action_cell_x]
mov ebx,TARGET_RANGE
sub ebx,[target_action_cell_y]
; DEBUGF 1, "%x npc_route_up target_up_left X: %x Y: %x\n",[current_cell_NPC]:1,edi,ebx
cmp edi,ebx
jb .continue
mov si,0x0100+ROUTE_LEFT
jmp save_route_to_current_position
;--------------------------------------
@@:
call npc_search_target_up_right
cmp [target_detected],1
jne @f
mov edi,[target_action_cell_x]
dec edi
mov ebx,TARGET_RANGE
sub ebx,[target_action_cell_y]
; DEBUGF 1, "%x npc_route_up target_up_right X: %x Y: %x\n",[current_cell_NPC]:1,edi,ebx
cmp edi,ebx
jb .continue
mov si,0x0100+ROUTE_RIGHT
jmp save_route_to_current_position
;--------------------------------------
@@:
.continue:
mov eax,[ecx-LEVEL_MAP_SIZE_X*4]
cmp ah,OBJECT_PROTAGONIST
je .continue_1
test ah,ah
jnz .change_route
;--------------------------------------
@@:
cmp al,BASE_WATER
jz .change_route
cmp al,BASE_LAVA
jz .change_route
;--------------------------------------
.continue_1:
; DEBUGF 1, "npc good route up\n"
mov si,0x0100+ROUTE_UP
mov edi,ecx
sub edi,LEVEL_MAP_SIZE_X*4
jmp save_new_and_clear_old_position
;---------------------------------------------------------------------
npc_route_down:
; DEBUGF 1, "npc route_down\n"
cmp ebx,LEVEL_MAP_SIZE_Y ; border of map?
jne @f
;--------------------------------------
.change_route:
; DEBUGF 1, "npc .change_route_down\n"
mov dx,0x0100+ROUTE_LEFT
call get_random_binary
test al,al
jz .save_new_route
 
mov dx,0x0100+ROUTE_UP
;--------------------------------------
.save_new_route:
rol edx,16
mov [ecx],edx
ret
;--------------------------------------
@@:
; DEBUGF 1, "npc down @@:\n"
call npc_search_target_down_left
cmp [target_detected],1
jne @f
mov edi,TARGET_RANGE
sub edi,[target_action_cell_x]
mov ebx,[target_action_cell_y]
dec ebx
; DEBUGF 1, "%x npc_route_down target_down_left X: %x Y: %x\n",[current_cell_NPC]:1,edi,ebx
cmp edi,ebx
jb .continue
mov si,0x0100+ROUTE_LEFT
jmp save_route_to_current_position
;--------------------------------------
@@:
call npc_search_target_down_right
cmp [target_detected],1
jne @f
mov edi,[target_action_cell_x]
dec edi
mov ebx,[target_action_cell_y]
; DEBUGF 1, "%x npc_route_down target_down_right X: %x Y: %x\n",[current_cell_NPC]:1,edi,ebx
cmp edi,ebx
jb .continue
mov si,0x0100+ROUTE_RIGHT
jmp save_route_to_current_position
;--------------------------------------
@@:
.continue:
mov eax,[ecx+LEVEL_MAP_SIZE_X*4]
cmp ah,OBJECT_PROTAGONIST
je .continue_1
 
test ah,ah
jnz .change_route
;--------------------------------------
@@:
cmp al,BASE_WATER
jz .change_route
cmp al,BASE_LAVA
jz .change_route
;--------------------------------------
.continue_1:
; DEBUGF 1, "npc good route down\n"
mov si,0x0100+ROUTE_DOWN
mov edi,ecx
add edi,LEVEL_MAP_SIZE_X*4
jmp save_new_and_clear_old_position
;---------------------------------------------------------------------
npc_route_left:
; DEBUGF 1, "npc route_left\n"
cmp eax,1 ; border of map?
jne @f
;--------------------------------------
.change_route:
; DEBUGF 1, "npc .change_route_left\n"
mov dx,0x0100+ROUTE_UP
call get_random_binary
test al,al
jz .save_new_route
 
mov dx,0x0100+ROUTE_RIGHT
;--------------------------------------
.save_new_route:
rol edx,16
mov [ecx],edx
ret
;--------------------------------------
@@:
; DEBUGF 1, "npc left @@:\n"
call npc_search_target_up_left
cmp [target_detected],1
jne @f
mov edi,TARGET_RANGE
sub edi,[target_action_cell_x]
mov ebx,TARGET_RANGE
sub ebx,[target_action_cell_y]
; DEBUGF 1, "%x npc_route_left target_up_left X: %x Y: %x\n",[current_cell_NPC]:1,edi,ebx
cmp edi,ebx
jae .continue
mov si,0x0100+ROUTE_UP
jmp save_route_to_current_position
;--------------------------------------
@@:
call npc_search_target_down_left
cmp [target_detected],1
jne @f
mov edi,TARGET_RANGE
sub edi,[target_action_cell_x]
mov ebx,[target_action_cell_y]
dec ebx
; DEBUGF 1, "%x npc_route_left target_down_left X: %x Y: %x\n",[current_cell_NPC]:1,edi,ebx
cmp edi,ebx
jae .continue
mov si,0x0100+ROUTE_DOWN
jmp save_route_to_current_position
;--------------------------------------
@@:
.continue:
mov eax,[ecx-4]
cmp ah,OBJECT_PROTAGONIST
je .continue_1
 
test ah,ah
jnz .change_route
;--------------------------------------
@@:
cmp al,BASE_WATER
jz .change_route
cmp al,BASE_LAVA
jz .change_route
;--------------------------------------
.continue_1:
; DEBUGF 1, "npc good route left\n"
mov si,0x0100+ROUTE_LEFT
mov edi,ecx
sub edi,4
jmp save_new_and_clear_old_position
;---------------------------------------------------------------------
npc_route_right:
; DEBUGF 1, "npc route_right\n"
cmp eax,LEVEL_MAP_SIZE_X ; border of map?
jne @f
;--------------------------------------
.change_route:
; DEBUGF 1, "npc .change_route_right\n"
mov dx,0x0100+ROUTE_DOWN
call get_random_binary
test al,al
jz .save_new_route
 
mov dx,0x0100+ROUTE_LEFT
;--------------------------------------
.save_new_route:
rol edx,16
mov [ecx],edx
ret
;--------------------------------------
@@:
; DEBUGF 1, "npc righ @@:\n"
call npc_search_target_up_right
cmp [target_detected],1
jne @f
mov edi,[target_action_cell_x]
dec edi
mov ebx,TARGET_RANGE
sub ebx,[target_action_cell_y]
; DEBUGF 1, "%x npc_route_right target_up_right X: %x Y: %x\n",[current_cell_NPC]:1,edi,ebx
cmp edi,ebx
jae .continue
mov si,0x0100+ROUTE_UP
jmp save_route_to_current_position
;--------------------------------------
@@:
call npc_search_target_down_right
cmp [target_detected],1
jne @f
mov edi,[target_action_cell_x]
dec edi
mov ebx,[target_action_cell_y]
dec ebx
; DEBUGF 1, "%x npc_route_right target_down_right X: %x Y: %x\n",[current_cell_NPC]:1,edi,ebx
cmp edi,ebx
jae .continue
mov si,0x0100+ROUTE_DOWN
jmp save_route_to_current_position
;--------------------------------------
@@:
.continue:
mov eax,[ecx+4]
 
cmp ah,OBJECT_PROTAGONIST
je .continue_1
 
test ah,ah
jnz .change_route
;--------------------------------------
@@:
cmp al,BASE_WATER
jz .change_route
cmp al,BASE_LAVA
jz .change_route
;--------------------------------------
.continue_1:
; DEBUGF 1, "npc good route righ\n"
mov si,0x0100+ROUTE_RIGHT
mov edi,ecx
add edi,4
jmp save_new_and_clear_old_position
;---------------------------------------------------------------------
npc_search_target_up_left:
; DEBUGF 1, "%x npc_search_target_up_left X: %x Y: %x\n",[current_cell_NPC]:1,[action_cell_x],[action_cell_y]
push ecx
sub ecx,TARGET_RANGE * 4 ; offset x
sub ecx,TARGET_RANGE * LEVEL_MAP_SIZE_X * 4 ; offset y
jmp npc_search_target
;---------------------------------------------------------------------
npc_search_target_up_right:
; DEBUGF 1, "%x npc_search_target_up_right X: %x Y: %x\n",[current_cell_NPC]:1,[action_cell_x],[action_cell_y]
push ecx
sub ecx,TARGET_RANGE * LEVEL_MAP_SIZE_X * 4 ; offset y
sub ecx,4 ; offset x
jmp npc_search_target
;---------------------------------------------------------------------
npc_search_target_down_left:
; DEBUGF 1, "%x npc_search_target_down_left X: %x Y: %x\n",[current_cell_NPC]:1,[action_cell_x],[action_cell_y]
push ecx
sub ecx,LEVEL_MAP_SIZE_X * 4 ; offset y
sub ecx,TARGET_RANGE * 4 ; offset x
jmp npc_search_target
;---------------------------------------------------------------------
npc_search_target_down_right:
; DEBUGF 1, "%x npc_search_target_down_right X: %x Y: %x\n",[current_cell_NPC]:1,[action_cell_x],[action_cell_y]
push ecx
sub ecx,LEVEL_MAP_SIZE_X * 4 ; offset y
sub ecx,4 ; offset x
;---------------------------------------------------------------------
npc_search_target:
push eax
mov [target_detected],0
mov ebx,TARGET_RANGE
;--------------------------------------
.y:
mov eax,TARGET_RANGE
; DEBUGF 1, "current cell next y\n"
;--------------------------------------
.x:
push eax ebx ecx
mov [target_action_cell_x],eax
mov [target_action_cell_y],ebx
shl eax,2
add ecx,eax
imul ebx,LEVEL_MAP_SIZE_X*4
add ecx,ebx
cmp ecx,plan_level
jb @f
cmp ecx,plan_level+LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4-4
ja @f
 
mov eax,[ecx]
; DEBUGF 1, "current cell %x\n",eax
cmp ah,OBJECT_PROTAGONIST
jne @f
pop ecx ebx eax
mov [target_detected],1
; DEBUGF 1, "%x target_detected X: %x Y: %x\n",[current_cell_NPC]:1,[target_action_cell_x],[target_action_cell_y]
jmp .exit
;--------------------------------------
@@:
pop ecx ebx eax
 
dec eax
jnz .x
dec ebx
jnz .y
.exit:
pop eax ecx
ret
;---------------------------------------------------------------------
/programs/games/rstearth/actions_white_bricks.inc
0,0 → 1,81
;---------------------------------------------------------------------
processing_white_brick:
;; DEBUGF 1, "processing_white_brick\n"
cmp dl,ROUTE_UP
je white_brick_route_up
 
cmp dl,ROUTE_DOWN
je white_brick_route_down
 
cmp dl,ROUTE_LEFT
je white_brick_route_left
 
cmp dl,ROUTE_RIGHT
je white_brick_route_right
 
ret
;---------------------------------------------------------------------
white_brick_route_up:
; DEBUGF 1, "white_brick route_up\n"
cmp ebx,1 ; border of map?
je action_stop
 
; DEBUGF 1, "white_brick up @@:\n"
mov eax,[ecx-LEVEL_MAP_SIZE_X*4]
cmp ah,OBJECT_WHITE_BRICK ; new coordinates have white block?
je action_stop
 
; DEBUGF 1, "white_brick good route up\n"
mov si,0x0100+ROUTE_UP
mov edi,ecx
sub edi,LEVEL_MAP_SIZE_X*4
jmp save_new_and_clear_old_position
;---------------------------------------------------------------------
white_brick_route_down:
; DEBUGF 1, "white_brick route_down\n"
cmp ebx,LEVEL_MAP_SIZE_Y ; border of map?
je action_stop
 
; DEBUGF 1, "white_brick down @@:\n"
mov eax,[ecx+LEVEL_MAP_SIZE_X*4]
cmp ah,OBJECT_WHITE_BRICK ; new coordinates have white block?
je action_stop
 
; DEBUGF 1, "white_brick good route down\n"
mov si,0x0100+ROUTE_DOWN
mov edi,ecx
add edi,LEVEL_MAP_SIZE_X*4
jmp save_new_and_clear_old_position
;---------------------------------------------------------------------
white_brick_route_left:
; DEBUGF 1, "white_brick route_left\n"
cmp eax,1 ; border of map?
je action_stop
 
; DEBUGF 1, "white_brick left @@:\n"
mov eax,[ecx-4]
cmp ah,OBJECT_WHITE_BRICK ; new coordinates have white block?
je action_stop
 
; DEBUGF 1, "white_brick good route left\n"
mov si,0x0100+ROUTE_LEFT
mov edi,ecx
sub edi,4
jmp save_new_and_clear_old_position
;---------------------------------------------------------------------
white_brick_route_right:
; DEBUGF 1, "white_brick route_right\n"
cmp eax,LEVEL_MAP_SIZE_X ; border of map?
je action_stop
 
; DEBUGF 1, "white_brick righ @@:\n"
mov eax,[ecx+4]
cmp ah,OBJECT_WHITE_BRICK ; new coordinates have white block?
je action_stop
 
; DEBUGF 1, "white_brick good route righ\n"
mov si,0x0100+ROUTE_RIGHT
mov edi,ecx
add edi,4
jmp save_new_and_clear_old_position
;---------------------------------------------------------------------
/programs/games/rstearth/error_window.inc
0,0 → 1,116
;---------------------------------------------------------------------
;start_error_window_thread:
; mcall 9,procinfo,-1
; mov eax,[ebx+46]
; shr eax,1
; add eax,[ebx+38]
; sub eax,40
; mov [error_window_y+2],ax
; mov eax,[ebx+42]
; shr eax,1
; add eax,[ebx+34]
; sub eax,125
; mov [error_window_x+2],ax
; mcall 51,1,thread_start,thread_stack
; DEBUGF 1, "start_error_window_thread\n"
; ret
;---------------------------------------------------------------------
thread_start:
mov eax,[N_error]
; DEBUGF 1, "thread_start N_error: %d\n",eax
; cmp al,1
; jne @f
; mov [N_error],load_ini_error_type
; mov [error_path],file_name
; jmp .error_type
;--------------------------------------
;@@:
cmp al,2
jne @f
mov [N_error],load_icons_error_type
mov [error_path],file_name
; DEBUGF 1, "error_path: %s\n",file_name
jmp .error_type
;--------------------------------------
@@:
cmp al,3
jne @f
mov [N_error],memory_free_error_type
xor eax,eax
mov [error_path],eax
mov [error_type],eax
jmp .red
;--------------------------------------
@@:
cmp al,4
jne @f
mov [N_error],memory_get_error_type
xor eax,eax
mov [error_path],eax
mov [error_type],eax
jmp .red
;--------------------------------------
@@:
; cmp al,5
; jne @f
; mov [N_error],load_directory_error_type
; mov [error_path],dir_path
; jmp .error_type
;--------------------------------------
;@@:
cmp al,6
jne .button
mov [N_error],convert_icons_error_type
mov [error_path],file_name
xor eax,eax
mov [error_type],eax
jmp .red
;--------------------------------------
.error_type:
; DEBUGF 1, ".error_type:\n"
mov eax,[error_type]
shl eax,2
add eax,error_fs_text_pointers
mov eax,[eax]
mov [error_type],eax
;--------------------------------------
.red:
; DEBUGF 1, "draw_error_window\n"
call draw_error_window
;--------------------------------------
.still:
mcall 10
cmp eax,1
je .red
cmp eax,2
je .key
cmp eax,3
je .button
jmp .still
;--------------------------------------
.key:
mcall 2
jmp .still
;--------------------------------------
.button:
mcall -1
;---------------------------------------------------------------------
draw_error_window:
mcall 12,1
mcall 0,[error_window_x],[error_window_y],0x03ff0000
mcall 4,<10,30>,0x90ffffff,[N_error]
mov eax,[error_path]
test eax,eax
jz @f
mcall 4,<10,50>,,[error_path]
;--------------------------------------
@@:
mov eax,[error_type]
test eax,eax
jz @f
mcall 4,<10,70>,,[error_type]
;--------------------------------------
@@:
mcall 12,2
ret
;---------------------------------------------------------------------
/programs/games/rstearth/icon_convert.inc
0,0 → 1,43
;---------------------------------------------------------------------
convert_icons:
xor eax,eax
mov [return_code],eax
 
push image_file
call [cnv_png_import.Start]
 
mov ecx,[image_file]
mcall 68,13,
test eax,eax
jz memory_free_error
 
cmp [return_code],dword 0
je @f
mov [N_error],6
jmp button.exit
@@:
 
; mov ebx,[raw_pointer]
; mov eax,[ebx+4]
; set of icon size x
; mov [file_browser_data_1.icon_size_x],ax
; mov eax,[ebx+8]
; set of icon size y
; mov [file_browser_data_1.icon_size_y],ax
; inc ax
; mov [file_browser_data_1.line_size_y],ax
; mov eax,[ebx+12]
; set of RAW resolution to pixel
; mov [file_browser_data_1.resolution_raw],eax
 
; mov eax,[ebx+20]
; add eax,ebx
; set RAW palette,use else resolution 8bit or less
; mov [file_browser_data_1.palette_raw],eax
 
; mov eax,[ebx+28]
; add eax,ebx
; set RAW area for icon
; mov [file_browser_data_1.icon_raw_area],eax
ret
;---------------------------------------------------------------------
/programs/games/rstearth/random.inc
0,0 → 1,8
;---------------------------------------------------------------------
get_random_binary:
push ebx
mcall 26,9
and eax,1b
pop ebx
ret
;---------------------------------------------------------------------
/programs/games/rstearth/show_base.inc
0,0 → 1,49
;---------------------------------------------------------------------
;copy_base_24bpp:
; DEBUGF 1, "copy_base_24bpp\n"
; push ecx
; mov esi,[eax+28] ; RAW area
; add esi,eax
; add esi,ebp
; mov edi,buffer_area
; mov ecx,SPRITE_SIZE_X*SPRITE_SIZE_Y
; cld
;--------------------------------------
;@@:
; lodsd
; and eax,0xffffff
; dec esi
; stosd
; dec ecx
; jnz @b
;
; pop ecx
; DEBUGF 1, "copy_base_24bpp end\n"
; ret
;---------------------------------------------------------------------
copy_base_8bpp:
; DEBUGF 1, "copy_base_8bpp\n"
push ecx
mov esi,[eax+28] ; RAW area
add esi,eax
add esi,ebp
 
mov ebp,[eax+20] ; RAW palette
add ebp,eax
mov edi,buffer_area
mov ecx,SPRITE_SIZE_X*SPRITE_SIZE_Y
cld
;--------------------------------------
@@:
lodsb
movzx eax,al
shl eax,2
mov eax,[eax+ebp]
stosd
dec ecx
jnz @b
 
pop ecx
; DEBUGF 1, "copy_base_8bpp end\n"
ret
;---------------------------------------------------------------------
/programs/games/rstearth/show_object.inc
0,0 → 1,362
;---------------------------------------------------------------------
calculate_new_characters_offsets_and_sizes:
mov eax,[ecx]
shr eax,16
and eax,0xff
;--------------------------------------
cmp eax,ROUTE_UP
jne @f
xor eax,eax
mov [characters_offset_y],eax
mov [characters_offset_x],eax
mov [buffer_offset_x],eax
mov eax,[show_tiles_iterations]
dec eax
mov [buffer_offset_y],eax
mov eax,SPRITE_SIZE_Y
sub eax,[buffer_offset_y]
mov [characters_size_y],eax
mov eax,SPRITE_SIZE_X
mov [characters_size_x],eax
jmp .ready
;--------------------------------------
@@:
cmp eax,ROUTE_DOWN
jne @f
xor eax,eax
mov [characters_offset_x],eax
mov [buffer_offset_y],eax
mov [buffer_offset_x],eax
 
mov eax,[show_tiles_iterations]
dec eax
mov [characters_offset_y],eax
mov eax,SPRITE_SIZE_Y
sub eax,[characters_offset_y]
mov [characters_size_y],eax
 
mov eax,SPRITE_SIZE_X
mov [characters_size_x],eax
jmp .ready
;--------------------------------------
@@:
cmp eax,ROUTE_LEFT
jne @f
xor eax,eax
mov [characters_offset_y],eax
mov [characters_offset_x],eax
mov [buffer_offset_y],eax
 
mov eax,[show_tiles_iterations]
dec eax
mov [buffer_offset_x],eax
mov eax,SPRITE_SIZE_X
sub eax,[buffer_offset_x]
mov [characters_size_x],eax
mov eax,SPRITE_SIZE_Y
mov [characters_size_y],eax
jmp .ready
;--------------------------------------
@@:
xor eax,eax
mov [characters_offset_y],eax
mov [buffer_offset_y],eax
mov [buffer_offset_x],eax
 
mov eax,[show_tiles_iterations]
dec eax
mov [characters_offset_x],eax
mov eax,SPRITE_SIZE_X
sub eax,[characters_offset_x]
mov [characters_size_x],eax
 
mov eax,SPRITE_SIZE_Y
mov [characters_size_y],eax
;--------------------------------------
.ready:
ret
;---------------------------------------------------------------------
calculate_old_characters_offsets_and_sizes:
mov eax,[ecx]
shr eax,16
and eax,0xff
;--------------------------------------
cmp eax,ROUTE_UP
jne @f
xor eax,eax
mov [characters_offset_x],eax
mov [buffer_offset_y],eax
mov [buffer_offset_x],eax
 
mov eax,SPRITE_SIZE_Y
sub eax,[show_tiles_iterations]
inc eax
mov [characters_offset_y],eax
mov eax,[show_tiles_iterations]
dec eax
mov [characters_size_y],eax
mov eax,SPRITE_SIZE_X
mov [characters_size_x],eax
jmp .ready
;--------------------------------------
@@:
cmp eax,ROUTE_DOWN
jne @f
xor eax,eax
mov [characters_offset_x],eax
mov [characters_offset_y],eax
mov [buffer_offset_x],eax
 
mov eax,SPRITE_SIZE_Y
sub eax,[show_tiles_iterations]
inc eax
mov [buffer_offset_y],eax
mov eax,[show_tiles_iterations]
dec eax
mov [characters_size_y],eax
 
mov eax,SPRITE_SIZE_X
mov [characters_size_x],eax
jmp .ready
;--------------------------------------
@@:
cmp eax,ROUTE_LEFT
jne @f
xor eax,eax
mov [characters_offset_y],eax
mov [buffer_offset_y],eax
mov [buffer_offset_x],eax
 
mov eax,SPRITE_SIZE_X
sub eax,[show_tiles_iterations]
inc eax
mov [characters_offset_x],eax
mov eax,[show_tiles_iterations]
dec eax
mov [characters_size_x],eax
mov eax,SPRITE_SIZE_Y
mov [characters_size_y],eax
jmp .ready
;--------------------------------------
@@:
xor eax,eax
mov [characters_offset_y],eax
mov [characters_offset_x],eax
mov [buffer_offset_y],eax
 
mov eax,SPRITE_SIZE_X
sub eax,[show_tiles_iterations]
inc eax
mov [buffer_offset_x],eax
mov eax,[show_tiles_iterations]
dec eax
mov [characters_size_x],eax
 
mov eax,SPRITE_SIZE_Y
mov [characters_size_y],eax
;--------------------------------------
.ready:
ret
;---------------------------------------------------------------------
analize_and_copy_object:
; DEBUGF 1, "analize_and_copy_object\n"
pusha
mov ebp,[ecx]
; DEBUGF 1, "EBP: %x ECX: %x\n",ebp, ecx
shr ebp,8
and ebp,0xff
test ebp,ebp
jz .no_characters
 
cmp ebp,OBJECT_DEATH
jnz @f
 
mov ebp,[ecx]
shr ebp,16
and ebp,0xff
mov eax,[npc_death_icons]
jmp .copy_characters_1
;--------------------------------------
@@:
cmp ebp,OBJECT_SKELETON
jnz @f
mov ebp,[ecx]
shr ebp,16
and ebp,0xff
 
mov eax,[npc_skeleton_icons]
jmp .copy_characters_1
;--------------------------------------
@@:
cmp ebp,OBJECT_IFRIT
jnz @f
mov ebp,[ecx]
shr ebp,16
and ebp,0xff
 
mov eax,[npc_ifrit_icons]
jmp .copy_characters_1
;--------------------------------------
@@:
cmp ebp,OBJECT_BARRET
jnz @f
mov ebp,[ecx]
shr ebp,16
and ebp,0xff
 
mov eax,[npc_barret_icons]
jmp .copy_characters_1
;--------------------------------------
@@:
cmp ebp,OBJECT_PROTAGONIST
jnz @f
 
mov eax,[npc_miku_icons]
mov ebp,[protagonist_route]
cmp ebp,5
jb .copy_characters_1
sub ebp,4
jmp .copy_characters_kick
;--------------------------------------
@@:
cmp ebp,OBJECT_RED_BRICK
jnz @f
mov eax,[red_brick_icons]
mov ebp,1
jmp .copy_characters
;--------------------------------------
@@:
cmp ebp,OBJECT_WHITE_BRICK
jnz @f
mov eax,[white_brick_icons]
mov ebp,1
jmp .copy_characters
;--------------------------------------
@@:
cmp ebp,RED_BRICK_CRASH_1 ; 0x80 - reb brick crash 1
jnz @f
; DEBUGF 1, "reb brick crash 11\n"
mov eax,[red_brick_icons]
mov ebp,2
jmp .copy_characters
;--------------------------------------
@@:
cmp ebp,RED_BRICK_CRASH_2 ; 0x81 - reb brick crash 2
jnz .no_characters
; DEBUGF 1, "reb brick crash 21\n"
mov eax,[red_brick_icons]
mov ebp,3
;--------------------------------------
.copy_characters:
dec ebp
imul ebp,SPRITE_SIZE_X*SPRITE_SIZE_Y; 8bpp
call copy_characters_with_offset
;--------------------------------------
.no_characters:
; DEBUGF 1, "analize_and_copy_object END\n"
popa
ret
;--------------------------------------
.copy_characters_kick:
dec ebp
imul ebp,SPRITE_SIZE_X*SPRITE_SIZE_Y; 8bpp
add ebp,SPRITE_SIZE_X*SPRITE_SIZE_Y*4*4 ; 8 bpp * 4 frames * 4 route
call copy_characters_with_offset
jmp .no_characters
;--------------------------------------
.copy_characters_1:
dec ebp
imul ebp,SPRITE_SIZE_X*SPRITE_SIZE_Y*4 ; 8 bpp * 4 frames
mov ebx,[show_tiles_iterations]
dec ebx
shr ebx,4 ; divider 16
imul ebx,SPRITE_SIZE_X*SPRITE_SIZE_Y ; 8bpp
add ebp,ebx
call copy_characters_with_offset
jmp .no_characters
;---------------------------------------------------------------------
copy_characters_with_offset:
; DEBUGF 1, "copy_characters_with_offset\n"
pusha ; ecx
 
mov esi,[eax+28] ; data offset
add esi,eax
add esi,ebp
mov ebp,[eax+20] ; palette offset
add ebp,eax
; add Y offset to source
mov eax,[characters_offset_y]
imul eax,SPRITE_SIZE_X ; 8bpp
add esi,eax
; add X offset to source
mov eax,[characters_offset_x]
add esi,eax ; 8bpp
 
mov edi,buffer_area
; add Y offset to destination
mov eax,[buffer_offset_y]
imul eax,SPRITE_SIZE_X*4 ; 32bpp
add edi,eax
; add X offset to destination
mov eax,[buffer_offset_x]
shl eax,2 ; 32bpp
add edi,eax
 
mov edx,[characters_size_y]
mov ecx,[characters_size_x]
cld
;--------------------------------------
.y:
push ecx esi edi
;--------------------------------------
.x:
lodsb
test al,al
jz .transparently
and eax,0xff
shl eax,2
mov eax,[ebp+eax] ; palette value
mov [edi],eax
;--------------------------------------
.transparently:
add edi,4
dec ecx
jnz .x
pop edi esi ecx
add esi,SPRITE_SIZE_X ; 8bpp
add edi,SPRITE_SIZE_X*4 ; 32bpp
dec edx
jnz .y
popa
ret
;---------------------------------------------------------------------
/programs/games/rstearth/show_tiles.inc
0,0 → 1,180
;---------------------------------------------------------------------
show_tiles_one_iteration:
mov [show_tiles_iterations],1
call copy_plan_level_to_plan_level_old
call show_tiles_1
call clear_show_flags_to_plan_level
call copy_plan_level_to_plan_level_old
ret
;---------------------------------------------------------------------
show_tiles:
mov [show_tiles_iterations],SPRITE_SIZE_X
;--------------------------------------
.loop:
call show_tiles_1
mcall 5,1
dec [show_tiles_iterations]
jnz .loop
 
call clear_show_flags_to_plan_level
call copy_plan_level_to_plan_level_old
ret
;---------------------------------------------------------------------
show_tiles_1:
; DEBUGF 1, "show_tiles_1\n"
; set start coordinates
xor edx,edx
mov ebx,LEVEL_MAP_SIZE_Y
mov ecx,plan_level
;--------------------------------------
.new_y:
mov eax,LEVEL_MAP_SIZE_X
ror edx,16
xor dx,dx
rol edx,16
;--------------------------------------
.new_x:
push eax ebx ecx
 
mov ebp,[ecx]
cmp [draw_all_level],1
je .draw_all_level
;; DEBUGF 1, "Y : %x X: %x cell: %x ebp: %x\n",ebx,eax,ecx,ebp
mov eax,ebp
rol eax,8
test al,al
jz .end_show_buffer
 
; cmp [show_tiles_iterations],1
; jne .not_clear
; mov al,0
;--------------------------------------
;.not_clear:
; ror eax,8
; mov [ecx],eax
;; DEBUGF 1, "new cell: %x eax: %x\n",ecx,eax
;--------------------------------------
.draw_all_level:
and ebp,0xff
mov eax,[base_icons]
imul ebp,SPRITE_SIZE_X*SPRITE_SIZE_Y ; 8bpp
; imul ebp,SPRITE_SIZE_X*SPRITE_SIZE_Y*3 ; 24bpp
call copy_base_8bpp
mov eax,[ecx+LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4]
mov ebp,ecx
sub ebp,plan_level
add ebp,plan_level_old
cmp [ebp+LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4],eax
jne @f
push dword [show_tiles_iterations]
mov [show_tiles_iterations],1
call calculate_new_characters_offsets_and_sizes
call analize_and_copy_object
pop dword [show_tiles_iterations]
jmp .draw_cell
;--------------------------------------
@@:
call calculate_new_characters_offsets_and_sizes
call analize_and_copy_object ; new object moves into the cell.
cmp [show_tiles_iterations],1
je .draw_cell
; mov eax,[ecx+LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4]
; DEBUGF 1, "object id new: %x\n",eax
sub ecx,plan_level
add ecx,plan_level_old
mov eax,[ecx]
shr eax,16
test al,al ; route or static?
jz .draw_cell
; mov eax,[ecx+LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4]
; DEBUGF 1, "object id old: %x\n",eax
; cmp [ecx+LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*4],eax
; je @f ; old and new state of the cell is equal
; DEBUGF 1, "old object moves out of the cell\n"
call calculate_old_characters_offsets_and_sizes
call analize_and_copy_object ; old object moves out of the cell
;--------------------------------------
.draw_cell:
xor ebp,ebp
mcall 65,buffer_area,<SPRITE_SIZE_X,SPRITE_SIZE_Y>,,32 ; 32bpp
;--------------------------------------
.end_show_buffer:
pop ecx ebx eax
add ecx,4
add edx,SPRITE_SIZE_X shl 16
dec eax
jnz .new_x
add edx,SPRITE_SIZE_Y
dec ebx
jnz .new_y
; DEBUGF 1, "show_tiles_1 END\n"
ret
;---------------------------------------------------------------------
map_level_to_plan_level:
; mov esi,map_level_0
; mov esi,map_level_game_over
mov edi,plan_level
mov ecx,LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y
cld
rep movsd
ret
;---------------------------------------------------------------------
generate_objects_id:
mov esi,plan_level
mov edi,objects_id
mov ecx,LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y
mov edx,1
cld
;--------------------------------------
.loop:
lodsd
mov ebx,eax
xor eax,eax
test bh,bh
jz @f
 
mov eax,edx
inc edx ; next object
;--------------------------------------
@@:
stosd
dec ecx
jnz .loop
 
; DEBUGF 1, "object id max: %x\n",edx
ret
;---------------------------------------------------------------------
copy_plan_level_to_plan_level_old:
mov esi,plan_level
mov edi,plan_level_old
mov ecx,LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y*2 ; plan_level + objects_id
cld
rep movsd
ret
;---------------------------------------------------------------------
clear_show_flags_to_plan_level:
mov esi,plan_level
mov edi,plan_level
mov ecx,LEVEL_MAP_SIZE_X*LEVEL_MAP_SIZE_Y
cld
;--------------------------------------
@@:
lodsd
ror eax,24
mov al,0
ror eax,8
stosd
dec ecx
jnz @b
 
ret
;---------------------------------------------------------------------
/programs/games/rstearth
Property changes:
Added: tsvn:logminsize
+5
\ No newline at end of property