From 986cce2c2a9b6c2ac6877bbd2e1cbcecae22490c Mon Sep 17 00:00:00 2001 From: ketmar Date: Thu, 15 Mar 2012 04:55:57 +0200 Subject: [PATCH] vial is working --- asm/defs/tiles.awa | 1 + asm/game/use/vial.awa | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++- asm/game/utils.awa | 20 ++++++++++++++ 3 files changed, 96 insertions(+), 1 deletion(-) diff --git a/asm/defs/tiles.awa b/asm/defs/tiles.awa index e7d0ef5..bdf254c 100644 --- a/asm/defs/tiles.awa +++ b/asm/defs/tiles.awa @@ -8,6 +8,7 @@ const: BTILE_DOORS_CE = 4 ; closed_end const: BTILE_DOOR_ADD_TO_OPEN = 4 const: FTILE_EMPTY = 0 +const: FTILE_GREEN = 2 const: FTILE_EARTH = 4 const: FTILE_GLASS = 5 const: FTILE_BOUNCE = 6 diff --git a/asm/game/use/vial.awa b/asm/game/use/vial.awa index 4ad5625..9974416 100644 --- a/asm/game/use/vial.awa +++ b/asm/game/use/vial.awa @@ -1,3 +1,77 @@ +; 43-46, 47 proc: game_use_vial - jmp game_no_no +locals: .f + ; can we use the vial? + psh -2 + bsr get_tile_at_dy + jne game_no_no, FTILE_EMPTY + ; ok, we can + set spr_dir, [spr_dir], [prof_item] + set pos_ty, -12, [prof_item] + set frozen, 1, [prof_item] + mul 12, [prof_dir], [.f] + set pos_tx, [.f], [prof_item] + res [prof_item] + set [spr_num], PSPR_USING + ; + set [.f], 43 +.down_loop: + set spr_num, [.f], [prof_item] + bsr game_next_frame + bsr game_next_frame + add [.f], 1 + jle .down_loop, [.f], 47 + ; + set [spr_num], PSPR_STANDING + ; drop falling + ; have brick at (y-1)? + psh -1 + bsr get_tile_at_dy + jne .create_brick_m2, FTILE_EMPTY ; yes: create brick at (y-2) + ; have brick at (y)? + psh 0 + bsr get_tile_at_dy + jeq .create_brick_m0, FTILE_EMPTY ; no: create brick at (y) + ; create brick at (y-1) + bsr drop_fall_one_tile + psh FTILE_GREEN + psh -1 + bsr set_tile_at_dy + jmp .quit + ; create brick at (y) +.create_brick_m0: + bsr drop_fall_one_tile + bsr drop_fall_one_tile + psh FTILE_GREEN + psh 0 + bsr set_tile_at_dy + jmp .quit + ; create brick at (y-2) +.create_brick_m2: + psh FTILE_GREEN + psh -2 + bsr set_tile_at_dy + ; +.quit: + ;kil [prof_item] + set spr_dir, DIR_LEFT, [prof_item] + set pos_ty, 0, [prof_item] + set frozen, 0, [prof_item] + set pos_tx, 0, [prof_item] + sus [prof_item] + ret endp: game_use_vial + + +proc: drop_fall_one_tile +local: .ty, .cnt + set [.cnt], 5 +.loop: + get [prof_item], pos_ty, [.ty] + add [.ty], 2 + set pos_ty, [.ty], [prof_item] + bsr game_next_frame + sub [.cnt], 1 + jgt .loop, [.cnt], 0 + ret +endp: drop_fall_one_tile diff --git a/asm/game/utils.awa b/asm/game/utils.awa index 8483e93..cfbff12 100644 --- a/asm/game/utils.awa +++ b/asm/game/utils.awa @@ -166,3 +166,23 @@ proc: game_do_pick bsr game_next_frame ret endp: game_do_pick + + +proc: get_tile_at_dy +arg: .dy +locals: .x, .y + add [prof_dir], [pos_x], [.x] + add [.dy], [pos_y], [.y] + mgf [.x], [.y], [.dy] + ret [.dy] +endp: get_tile_at_dy + + +proc: set_tile_at_dy +arg: .tile, .dy +locals: .x, .y + add [prof_dir], [pos_x], [.x] + add [.dy], [pos_y], [.y] + msf [.x], [.y], [.tile] + ret +endp: set_tile_at_dy -- 2.11.4.GIT