From b006b22b49348dba8c668c27075d077ac26a50ae Mon Sep 17 00:00:00 2001 From: ketmar Date: Thu, 15 Mar 2012 02:57:44 +0200 Subject: [PATCH] Harry eats apples --- asm/defs/rst.awa | 4 ++++ asm/items/i_apple.awa | 4 +++- asm/items/i_harry.awa | 2 +- asm/items/items.awa | 14 +++++++------- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/asm/defs/rst.awa b/asm/defs/rst.awa index cf229ce..e9d18d5 100644 --- a/asm/defs/rst.awa +++ b/asm/defs/rst.awa @@ -6,3 +6,7 @@ econst: FRST_ML_GAME = 2 ; mainloop: game econst: FRST_MINIMAP = 3 ; enter 'minimap' mode econst: FRST_LOAD_LEVEL = 10 ; arg1: level number + + +econst: FRST_DEBUG_PRINT_STR = 600 ; arg1: string offset (arg2: length, else asciiz) +econst: FRST_DEBUG_PRINT_NUM = 601 ; arg1..arg2: nums diff --git a/asm/items/i_apple.awa b/asm/items/i_apple.awa index e624793..1effe2d 100644 --- a/asm/items/i_apple.awa +++ b/asm/items/i_apple.awa @@ -1,4 +1,4 @@ -entry_item_apple: +proc: entry_item_apple .loop: jne .frozen, [frozen], 0 jne .nomc, [pos_ty], 0 @@ -6,6 +6,7 @@ entry_item_apple: psh ITEM_HARRY bsr item_at_me_typed set [rst_result] + ; jeq .nomc, [rst_result], 0 ; monster eats the apple ;kil [rst_result] @@ -16,3 +17,4 @@ entry_item_apple: .frozen: brk jmp .loop +endp: entry_item_apple diff --git a/asm/items/i_harry.awa b/asm/items/i_harry.awa index 84a6423..3e8b372 100644 --- a/asm/items/i_harry.awa +++ b/asm/items/i_harry.awa @@ -1,10 +1,10 @@ proc: entry_item_monster local: .frm - ; jlt .badframe, [aframe], 0 jgt .badframe, [aframe], 9 mul [aframe], 2 jmp .loop + ; .badframe: set [aframe], 0 diff --git a/asm/items/items.awa b/asm/items/items.awa index 692f6be..573f7d4 100644 --- a/asm/items/items.awa +++ b/asm/items/items.awa @@ -20,19 +20,19 @@ const: ITEM_ANIM_DELAY = 5 ; proc: item_at_me_typed arg: .item_type -locals: .cnt - ; +locals: .cnt, .t set [.cnt], 1 .loop: ; no self-detection + psh [.cnt] tid - jeq .next, [.cnt] + jeq .next ; only running threads sta [.cnt] jne .next, THREAD_STATE_RUNNING ; only wanted type - get [.cnt], item_id - jne .next, [.item_type] + get [.cnt], item_id, [.t] + jne .next, [.t], [.item_type] ; only not activated get [.cnt], activated jne .next, 0 @@ -47,7 +47,6 @@ locals: .cnt get [.cnt], pos_y jne .next, [pos_y] ; found - kil 0 ret [.cnt] .next: add [.cnt], 1 @@ -62,6 +61,7 @@ proc: item_check_fall ;set [fall_count], 0 mgf [pos_x], [pos_y] jne .quit, FTILE_EMPTY + set [pos_ty], 1 set [falling], 1 jmp .falling .quit: @@ -87,7 +87,7 @@ local: .sy jge item_fall_dead, [pos_y], [.sy] mgf [pos_x], [pos_y] jne .quit, FTILE_EMPTY - add [pos_ty], 2 + set [pos_ty], 2 .quit: ret endp: item_do_fall_step -- 2.11.4.GIT