diff --git a/programs/games/rstearth/actions.inc b/programs/games/rstearth/actions.inc new file mode 100644 index 0000000000..f787cc93b5 --- /dev/null +++ b/programs/games/rstearth/actions.inc @@ -0,0 +1,150 @@ +;--------------------------------------------------------------------- +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: + mov [death_of_protagonist],0 + 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 +;-------------------------------------- +.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 +;--------------------------------------------------------------------- diff --git a/programs/games/rstearth/actions_npc.inc b/programs/games/rstearth/actions_npc.inc new file mode 100644 index 0000000000..527dbbdb7a --- /dev/null +++ b/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 +;--------------------------------------------------------------------- diff --git a/programs/games/rstearth/actions_protagonist.inc b/programs/games/rstearth/actions_protagonist.inc new file mode 100644 index 0000000000..b2c969c60b --- /dev/null +++ b/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 +;--------------------------------------------------------------------- diff --git a/programs/games/rstearth/actions_white_bricks.inc b/programs/games/rstearth/actions_white_bricks.inc new file mode 100644 index 0000000000..591b0c7970 --- /dev/null +++ b/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 +;--------------------------------------------------------------------- diff --git a/programs/games/rstearth/build_en.bat b/programs/games/rstearth/build_en.bat new file mode 100644 index 0000000000..7aae0cad65 --- /dev/null +++ b/programs/games/rstearth/build_en.bat @@ -0,0 +1,17 @@ +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\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 +@pause \ No newline at end of file diff --git a/programs/games/rstearth/build_ru.bat b/programs/games/rstearth/build_ru.bat new file mode 100644 index 0000000000..b4ea8e2192 --- /dev/null +++ b/programs/games/rstearth/build_ru.bat @@ -0,0 +1,17 @@ +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\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 +@pause \ No newline at end of file diff --git a/programs/games/rstearth/death_protagonist.inc b/programs/games/rstearth/death_protagonist.inc new file mode 100644 index 0000000000..b3c8f00f12 --- /dev/null +++ b/programs/games/rstearth/death_protagonist.inc @@ -0,0 +1,47 @@ +;--------------------------------------------------------------------- +death_of_protagonist_start: + mov esi,map_level_game_over + call map_level_to_plan_level +.red: + call draw_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 start_level_0 + + mov [extended_key],1 + jmp .still +;--------------------------------------------------------------------- +.extended_key: + mov [extended_key],0 + jmp start_level_0 +;--------------------------------------------------------------------- +.button: + mcall 17 + + cmp ah,1 + jne .still + + jmp button.exit +;-------------------------------------- \ No newline at end of file diff --git a/programs/games/rstearth/error_window.inc b/programs/games/rstearth/error_window.inc new file mode 100644 index 0000000000..84aae905d5 --- /dev/null +++ b/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 +;--------------------------------------------------------------------- diff --git a/programs/games/rstearth/i_data.inc b/programs/games/rstearth/i_data.inc new file mode 100644 index 0000000000..0c1c933049 --- /dev/null +++ b/programs/games/rstearth/i_data.inc @@ -0,0 +1,267 @@ +;--------------------------------------------------------------------- +; 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 key or ',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 +;--------------------------------------------------------------------- +lsz title,\ + ru,' (⨯ 1.4) 21.12.2014',\ + en,'Rusty Earth (Prototype 1.4) 21.12.2014' + db 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 +;--------------------------------------------------------------------- +protagonist_route dd 2 +protagonist_position: +.x dd 4 +.y dd 4 +;--------------------------------------------------------------------- + diff --git a/programs/games/rstearth/icon_convert.inc b/programs/games/rstearth/icon_convert.inc new file mode 100644 index 0000000000..257be17a28 --- /dev/null +++ b/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 +;--------------------------------------------------------------------- diff --git a/programs/games/rstearth/key.inc b/programs/games/rstearth/key.inc new file mode 100644 index 0000000000..cd61783360 --- /dev/null +++ b/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 +;--------------------------------------------------------------------- diff --git a/programs/games/rstearth/levels.inc b/programs/games/rstearth/levels.inc new file mode 100644 index 0000000000..321e0115fe --- /dev/null +++ b/programs/games/rstearth/levels.inc @@ -0,0 +1,34 @@ +;--------------------------------------------------------------------- +; 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_0: + 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_game_over: + dd 000000h,000000h,000000h,000000h,000000h,000000h,000000h,000000h,000000h,000000h + dd 000000h,000002h,000002h,000000h,000000h,000002h,000000h,000002h,000002h,000000h + dd 000000h,000002h,000000h,000002h,000000h,000002h,000000h,000002h,000000h,000002h + dd 000000h,000002h,000000h,000002h,000000h,000002h,000000h,000002h,000000h,000002h + dd 000000h,000002h,000000h,000002h,000000h,000002h,000000h,000002h,000000h,000002h + dd 000000h,000002h,000002h,000000h,000000h,000002h,000000h,000002h,000002h,000000h + dd 000000h,000002h,000000h,000002h,000000h,000002h,000000h,000002h,000000h,000000h + dd 000000h,000002h,000000h,000002h,000000h,000002h,000000h,000002h,000000h,000000h + dd 000000h,000002h,000000h,000002h,000000h,000002h,000000h,000002h,000000h,000000h + dd 000000h,000000h,000000h,000000h,000000h,000000h,000000h,000000h,000000h,000000h +;--------------------------------------------------------------------- diff --git a/programs/games/rstearth/load.inc b/programs/games/rstearth/load.inc new file mode 100644 index 0000000000..e42a218a9f --- /dev/null +++ b/programs/games/rstearth/load.inc @@ -0,0 +1,153 @@ +;--------------------------------------------------------------------- +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_all_icons: +; load and convert base icons + mov ebx,base_icons_file_name + call load_and_convert_current_icon_set + mov [base_icons],eax +; DEBUGF 1, "base_icons: %x\n",eax + +; load and convert base icons +; 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 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 + + ret +;--------------------------------------------------------------------- \ No newline at end of file diff --git a/programs/games/rstearth/random.inc b/programs/games/rstearth/random.inc new file mode 100644 index 0000000000..32b22570d9 --- /dev/null +++ b/programs/games/rstearth/random.inc @@ -0,0 +1,8 @@ +;--------------------------------------------------------------------- +get_random_binary: + push ebx + mcall 26,9 + and eax,1b + pop ebx + ret +;--------------------------------------------------------------------- diff --git a/programs/games/rstearth/resources/barret_8bpp.png b/programs/games/rstearth/resources/barret_8bpp.png new file mode 100644 index 0000000000..e4c83a308d Binary files /dev/null and b/programs/games/rstearth/resources/barret_8bpp.png differ diff --git a/programs/games/rstearth/resources/base_8bpp.png b/programs/games/rstearth/resources/base_8bpp.png new file mode 100644 index 0000000000..d6306dcd9e Binary files /dev/null and b/programs/games/rstearth/resources/base_8bpp.png differ diff --git a/programs/games/rstearth/resources/death_8bpp.png b/programs/games/rstearth/resources/death_8bpp.png new file mode 100644 index 0000000000..fc27479c72 Binary files /dev/null and b/programs/games/rstearth/resources/death_8bpp.png differ diff --git a/programs/games/rstearth/resources/flaunch.wav b/programs/games/rstearth/resources/flaunch.wav new file mode 100644 index 0000000000..9c40db9175 Binary files /dev/null and b/programs/games/rstearth/resources/flaunch.wav differ diff --git a/programs/games/rstearth/resources/ifrit_8bpp.png b/programs/games/rstearth/resources/ifrit_8bpp.png new file mode 100644 index 0000000000..2dd74deb52 Binary files /dev/null and b/programs/games/rstearth/resources/ifrit_8bpp.png differ diff --git a/programs/games/rstearth/resources/miku_8bpp.png b/programs/games/rstearth/resources/miku_8bpp.png new file mode 100644 index 0000000000..60697d3838 Binary files /dev/null and b/programs/games/rstearth/resources/miku_8bpp.png differ diff --git a/programs/games/rstearth/resources/red_brick_8bpp.png b/programs/games/rstearth/resources/red_brick_8bpp.png new file mode 100644 index 0000000000..1a85f7c197 Binary files /dev/null and b/programs/games/rstearth/resources/red_brick_8bpp.png differ diff --git a/programs/games/rstearth/resources/skeleton_8bpp.png b/programs/games/rstearth/resources/skeleton_8bpp.png new file mode 100644 index 0000000000..c2da46028c Binary files /dev/null and b/programs/games/rstearth/resources/skeleton_8bpp.png differ diff --git a/programs/games/rstearth/resources/walking_with_poseidon.wav b/programs/games/rstearth/resources/walking_with_poseidon.wav new file mode 100644 index 0000000000..512dad7b5a Binary files /dev/null and b/programs/games/rstearth/resources/walking_with_poseidon.wav differ diff --git a/programs/games/rstearth/resources/white_brick_8bpp.png b/programs/games/rstearth/resources/white_brick_8bpp.png new file mode 100644 index 0000000000..c4fe5afa3b Binary files /dev/null and b/programs/games/rstearth/resources/white_brick_8bpp.png differ diff --git a/programs/games/rstearth/rstearth.asm b/programs/games/rstearth/rstearth.asm new file mode 100644 index 0000000000..9814ea5bf9 --- /dev/null +++ b/programs/games/rstearth/rstearth.asm @@ -0,0 +1,214 @@ +;***************************************************************************** +; 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 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 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 0x0 + 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 +;--------------------------------------------------------------------- +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 +OBJECT_PROTAGONIST = 15 +OBJECT_RED_BRICK = 16 +OBJECT_WHITE_BRICK = 17 +RED_BRICK_CRASH_1 = 0x80 +RED_BRICK_CRASH_2 = 0x81 +;----------------------------------------------------------------------------- +BASE_SMALL_ROCK = 0 +BASE_GRASS = 1 +BASE_LAVA = 2 +BASE_WATER = 3 +;----------------------------------------------------------------------------- +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 + 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 initialize_sound_system + + mcall 51,1,snd_background_music_thread_start,snd_background_music_thread_stack +;--------------------------------------------------------------------- +start_level_0: + mov [death_of_protagonist],0 + mov [protagonist_route],2 + mov [protagonist_position.x],4 + mov [protagonist_position.y],4 + + 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_start + + 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_start + + 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 +;-------------------------------------- +@@: + 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 +;--------------------------------------------------------------------- +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 'death_protagonist.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 'i_data.inc' +include 'levels.inc' +;--------------------------------------------------------------------- +IM_END: +;--------------------------------------------------------------------- +;include_debug_strings +;--------------------------------------------------------------------- +include 'u_data.inc' +;--------------------------------------------------------------------- +I_END: diff --git a/programs/games/rstearth/show_base.inc b/programs/games/rstearth/show_base.inc new file mode 100644 index 0000000000..ce6fd6f8f8 --- /dev/null +++ b/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 +;--------------------------------------------------------------------- diff --git a/programs/games/rstearth/show_object.inc b/programs/games/rstearth/show_object.inc new file mode 100644 index 0000000000..d1d112d724 --- /dev/null +++ b/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 +;--------------------------------------------------------------------- diff --git a/programs/games/rstearth/show_tiles.inc b/programs/games/rstearth/show_tiles.inc new file mode 100644 index 0000000000..4d49f06d1e --- /dev/null +++ b/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,,,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 +;--------------------------------------------------------------------- diff --git a/programs/games/rstearth/snd_api.inc b/programs/games/rstearth/snd_api.inc new file mode 100644 index 0000000000..4588461998 --- /dev/null +++ b/programs/games/rstearth/snd_api.inc @@ -0,0 +1,409 @@ +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 +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 +;------------------------------------------------------------------------------ \ No newline at end of file diff --git a/programs/games/rstearth/sound.inc b/programs/games/rstearth/sound.inc new file mode 100644 index 0000000000..bc8d805849 --- /dev/null +++ b/programs/games/rstearth/sound.inc @@ -0,0 +1,169 @@ +;------------------------------------------------------------------------------ +; init.obj +; _InitSound@4 , +; _CreateBuffer@12 , +; _DestroyBuffer@4 +; +; sndgetsize.obj +; _GetBufferSize@8 , +; _GetBufferFree@8 WTF??? +; +; setbuf.obj +; _SetBuffer@16 , +; _PlayBuffer@8 , +; +; stopbuf.obj +; _StopBuffer@4 , +;------------------------------------------------------------------------------ +initialize_sound_system: + mov [sound_flag],1 + + stdcall _InitSound@4,version + cmp eax,-1 + je 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 _test_wav@4,dword [wav_for_test] ;letter_1a + test eax,eax + jz snd_test_wav_fail + + or eax,PCM_OUT + mov [snd_format],eax + +; DEBUGF 1, "Test wav successful %x\n",eax + + call find_data_offset + + mov al,[sound_flag] + test al,al + jz .exit + + stdcall _CreateBuffer@12,[snd_format],0,hBuff1 + cmp eax,-1 + je snd_create_buffer_fail + +; DEBUGF 1, "Create Buffer 1 successful %x\n",eax + + stdcall _CreateBuffer@12,[snd_format],0,hBuff2 + cmp eax,-1 + je snd_create_buffer_fail + +; DEBUGF 1, "Create Buffer 1 successful %x\n",eax +;-------------------------------------- +.exit: + ret +;------------------------------------------------------------------------------ +find_data_offset: + mov esi,[wav_for_test] ;letter_1a +;-------------------------------------- +@@: + cmp [esi],dword 'data' + je @f + + inc esi + cmp esi,[wav_for_test_end] ;letter_1a + letter_2b + jne @b + +; DEBUGF 1, "find data offset fail\n" + mov [sound_flag],0 + ret +;-------------------------------------- +@@: + sub esi,[wav_for_test] ;letter_1a + add esi,4 + mov [data_offset],esi + ret +;------------------------------------------------------------------------------ +wave_out: +; in: +; eax - adress of wav sample +; ebp - hBuff ; hardware buffer + pusha +; DEBUGF 1, "Wave out\n" +; 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 .exit +;-------------------------------------- +@@: + add eax,[data_offset] + mov ebx,[eax] + add eax,4 +; DEBUGF 1, "src EAX: %x size EBX: %x\n",eax,ebx +; stdcall _WaveOut@12,[hBuff],eax,ebx + stdcall _WaveOut@12,ebp,eax,ebx +; DEBUGF 1, "return EAX: %x\n",eax + cmp eax,-1 + popa + je snd_wave_out_fail +;-------------------------------------- +.exit: + ret +;------------------------------------------------------------------------------ +snd_init_fail: +; DEBUGF 1, "Sound init fail %x\n",eax + mov [sound_flag],0 + ret +;------------------------------------------------------------------------------ +snd_version_fail: +; DEBUGF 1, "Sound version fail %x\n",eax + mov [sound_flag],0 + ret +;------------------------------------------------------------------------------ +snd_test_wav_fail: +; DEBUGF 1, "Test wav fail %x\n",eax + mov [sound_flag],0 + ret +;------------------------------------------------------------------------------ +snd_create_buffer_fail: +; DEBUGF 1, "Create Buffer fail %x\n",eax + mov [sound_flag],0 + ret +;------------------------------------------------------------------------------ +snd_wave_out_fail: +; DEBUGF 1, "Wave Out fail\n" + mov [sound_flag],0 + ret +;------------------------------------------------------------------------------ +snd_background_music_thread_start: + mov eax,[background_music] + mov ebp,[hBuff1] + call wave_out + jmp snd_background_music_thread_start +; mcall -1 +;------------------------------------------------------------------------------ +snd_kick_action: + cmp [snd_kick_flag],1 + je @f + + mcall 51,1,snd_kick_action_thread_start,snd_kick_action_thread_stack +;-------------------------------------- +@@: + ret +;------------------------------------------------------------------------------ +snd_kick_action_thread_start: + mov [snd_kick_flag],1 + mov eax,[stone_kick_sound] + mov ebp,[hBuff2] + call wave_out + mov [snd_kick_flag],0 + mcall -1 +;------------------------------------------------------------------------------ \ No newline at end of file diff --git a/programs/games/rstearth/u_data.inc b/programs/games/rstearth/u_data.inc new file mode 100644 index 0000000000..f22dc8ca24 --- /dev/null +++ b/programs/games/rstearth/u_data.inc @@ -0,0 +1,117 @@ +;--------------------------------------------------------------------- +; uninitialized data +;--------------------------------------------------------------------- +extended_key rb 1 +draw_all_level rb 1 +current_cell_NPC rb 1 +death_of_protagonist rb 1 +target_detected rb 1 +sound_flag rb 1 +snd_kick_flag rb 1 +;--------------------------------------------------------------------- +align 4 +N_error rd 1 +error_type rd 1 +error_path 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 +stone_kick_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 +;------------------------------------------------------------------------------ +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 rd 1 +hBuff1 rd 1 +hBuff2 rd 1 + +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 +;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: +;--------------------------------------------------------------------- \ No newline at end of file