From 7776be29e8121c4ac23ef74512cf504abd55bc69 Mon Sep 17 00:00:00 2001 From: ketmar Date: Sun, 18 Mar 2012 02:54:46 +0200 Subject: [PATCH] asm: dbg macros; decoded one more level byte --- asm/awlogic.awa | 6 ++++++ asm/defs/rst.awa | 3 +++ asm/defs/tvars.awa | 1 + asm/items/i_fan.awa | 2 +- asm/items/i_harry.awa | 18 +++++++++--------- asm/items/i_vial.awa | 2 +- asm/items/items.awa | 3 ++- asm/loaders/avishlevel.awa | 38 +++++++++++++++++++++++++++++++++----- asm/macs.awa | 1 + asm/macs/dbg.awa | 35 +++++++++++++++++++++++++++++++++++ 10 files changed, 92 insertions(+), 17 deletions(-) create mode 100644 asm/macs.awa create mode 100644 asm/macs/dbg.awa diff --git a/asm/awlogic.awa b/asm/awlogic.awa index 4225dd9..ae4feec 100644 --- a/asm/awlogic.awa +++ b/asm/awlogic.awa @@ -17,6 +17,9 @@ public: entry_title public: entry_game_initialize public: entry_game_restart_level + +include: macs.awa + include: defs.awa include: title.awa include: items.awa @@ -30,3 +33,6 @@ include: loaders.awa ; entry_room_onunload will be called (if preset) before unloading current room data + + +used: entry_get_level_code diff --git a/asm/defs/rst.awa b/asm/defs/rst.awa index ad8d74d..54f0d6d 100644 --- a/asm/defs/rst.awa +++ b/asm/defs/rst.awa @@ -29,6 +29,8 @@ econst: FRST_GET_LEVEL_FILE_WORD = 15 ; arg: offset; signed econst: FRST_SET_LEVEL_SIZE = 16 ; arg1: width, arg2: height (call this before setting tiles) econst: FRST_SET_LEVEL_NAME = 17 ; arg1: pos(<0: in level data; pos=(-pos)-1); arg2 (if present) name length, else asiiz +//econst: FRST_NEW_LEVEL_FILE = 30 ; arg1: pos(<0: in level data; pos=(-pos)-1); arg2 (if present) name length, else asiiz + econst: FRST_GET_MAX_THREADS = 100 econst: FRST_GET_MAX_THREAD_ID = 101 @@ -41,3 +43,4 @@ econst: FRST_SET_SEED_L = 204 econst: FRST_DEBUG_PRINT_STR = 600 ; arg1: string offset (arg2: length, else asciiz) econst: FRST_DEBUG_PRINT_NUM = 601 ; arg1..arg2: num +econst: FRST_DEBUG_ABORT = 666 diff --git a/asm/defs/tvars.awa b/asm/defs/tvars.awa index e2fa63c..703ba8f 100644 --- a/asm/defs/tvars.awa +++ b/asm/defs/tvars.awa @@ -32,3 +32,4 @@ deftvar: activated deftvar: fall_count deftvar: falling deftvar: frozen +deftvar: animspeed diff --git a/asm/items/i_fan.awa b/asm/items/i_fan.awa index 264a75f..d75b9c8 100644 --- a/asm/items/i_fan.awa +++ b/asm/items/i_fan.awa @@ -19,7 +19,7 @@ entry_item_fan: .frozen: sub [apause], 1 jgt .noanim, [apause], 0 - set [apause], ITEM_ANIM_DELAY + set [apause], [animspeed] jeq .noanim, [animated], 0 add [spr_num], 1 jlt .noanim, [spr_num], [alast_frame] diff --git a/asm/items/i_harry.awa b/asm/items/i_harry.awa index 9dc23e0..e021870 100644 --- a/asm/items/i_harry.awa +++ b/asm/items/i_harry.awa @@ -14,12 +14,12 @@ */ proc: entry_item_monster local: .frm - jlt .badframe, [aframe], 0 - jgt .badframe, [aframe], 9 + jlt @@f, [aframe], 0 + jgt @@f, [aframe], 9 mul [aframe], 2 jmp .loop ; -.badframe: +@@: set [aframe], 0 .loop: @@ -27,19 +27,19 @@ local: .frm ; jne item_monster_eats_apple, [activated], 0 ; + jeq .noanim, [animated], 0 sub [apause], 1 jgt .noanim, [apause], 0 - set [apause], ITEM_ANIM_DELAY - jeq .noanim, [animated], 0 + set [apause], [animspeed] ; -.animagain: +@@: add monster_animation, [aframe], [spr_num] add [aframe], 1 rxc [spr_num], [.frm] - jne .animok, [.frm], 255 + jne @@f, [.frm], 255 set [aframe], 0 - jmp .animagain -.animok: + jmp @@b +@@: set [spr_num], [.frm] .noanim: bsr item_check_fall diff --git a/asm/items/i_vial.awa b/asm/items/i_vial.awa index ba5480d..7f9d66d 100644 --- a/asm/items/i_vial.awa +++ b/asm/items/i_vial.awa @@ -19,7 +19,7 @@ entry_item_vial: ;.notact: sub [apause], 1 jgt .noanim, [apause], 0 - set [apause], ITEM_ANIM_DELAY + set [apause], [animspeed] jeq .noanim, [animated], 0 add [spr_num], 1 jlt .noanim, [spr_num], [alast_frame] diff --git a/asm/items/items.awa b/asm/items/items.awa index f07997f..65d499d 100644 --- a/asm/items/items.awa +++ b/asm/items/items.awa @@ -195,7 +195,8 @@ entry_item: set [fall_count], 0 set [falling], 0 set [frozen], 0 - set [apause], ITEM_ANIM_DELAY + ;set [apause], ITEM_ANIM_DELAY + set [apause], [animspeed] set [pos_tx], 0 set [pos_ty], 0 set [liftdown], 0 diff --git a/asm/loaders/avishlevel.awa b/asm/loaders/avishlevel.awa index 8d914f0..d39012c 100644 --- a/asm/loaders/avishlevel.awa +++ b/asm/loaders/avishlevel.awa @@ -21,7 +21,10 @@ const: AVISH_MAP_HEIGHT = 41 proc: avish_level_loader arg: .level_idx locals: .pos, .x, .y, .item_count -locals: .fframe, .lframe, .frame, .animated, .type, .tid +locals: .fframe, .lframe, .frame, .animated, .animspeed, .type, .tid + dbgprintstr "loading level #" + dbgprintnumnl [.level_idx] + ; rst FRST_OPEN_LEVEL_FILE, [.level_idx] ; set level name rst FRST_GET_LEVEL_FILE_BYTE, 0 ; name length @@ -103,20 +106,45 @@ locals: .fframe, .lframe, .frame, .animated, .type, .tid set [.frame], [.fframe] .item_anim_nofix: ; skip 0xff +;;; rst FRST_GET_LEVEL_FILE_BYTE, [.pos] +;;; jeq @@f, [rst_result], 255 +;;; rst FRST_DEBUG_ABORT +;;;@@: + add [.pos], 1 + ; skip 1 unknown byte + add [.pos], 1 + ; animation speed + rst FRST_GET_LEVEL_FILE_BYTE, [.pos] + ;mul ITEM_ANIM_DELAY, [rst_result], [.animspeed] + set [.animspeed], [rst_result] + add [.pos], 1 + ; skip unknown byte +;;; rst FRST_GET_LEVEL_FILE_BYTE, [.pos] +;;; jeq @@f, [rst_result], 0 +;;; rst FRST_DEBUG_ABORT +;;;@@: + add [.pos], 1 + ; skip unknown byte +;;; rst FRST_GET_LEVEL_FILE_BYTE, [.pos] +;;; jeq @@f, [rst_result], 0 +;;; rst FRST_DEBUG_ABORT +;;;@@: add [.pos], 1 - ; - ; skip 4 unknown bytes - add [.pos], 4 ; item type rst FRST_GET_LEVEL_FILE_BYTE, [.pos] add [.pos], 1 set [.type], [rst_result] ; skip unknown byte +;;; rst FRST_GET_LEVEL_FILE_BYTE, [.pos] +;;; jeq @@f, [rst_result], 0 +;;; rst FRST_DEBUG_ABORT +;;;@@: add [.pos], 1 ; spawn and initialize item thread new entry_item, [.tid] set item_id, [.type], [.tid] set animated, [.animated], [.tid] + set animspeed, [.animspeed], [.tid] set afirst_frame, [.fframe], [.tid] set alast_frame, [.lframe], [.tid] set aframe, [.frame], [.tid] @@ -126,7 +154,7 @@ locals: .fframe, .lframe, .frame, .animated, .type, .tid rst FRST_GET_LEVEL_FILE_BYTE, [.pos] add [.pos], 6 set aframe, [rst_result], [.tid] - set spr_num, [rst_result], [.tid] + ;set spr_num, [rst_result], [.tid] .no_fix_aframe: set pos_x, [.x], [.tid] set pos_y, [.y], [.tid] diff --git a/asm/macs.awa b/asm/macs.awa new file mode 100644 index 0000000..6fac302 --- /dev/null +++ b/asm/macs.awa @@ -0,0 +1 @@ +include: macs/dbg.awa diff --git a/asm/macs/dbg.awa b/asm/macs/dbg.awa new file mode 100644 index 0000000..90c282b --- /dev/null +++ b/asm/macs/dbg.awa @@ -0,0 +1,35 @@ +MACRO: dbgprintnl + rst FRST_DEBUG_PRINT_STR, -10 +ENDMACRO + +MACRO: dbgprintnum num + rst FRST_DEBUG_PRINT_NUM, num +ENDMACRO + +MACRO: dbgprintnum2 num0, num1 + rst FRST_DEBUG_PRINT_NUM, num0, num1 +ENDMACRO + +MACRO: dbgprintstr str + rst FRST_DEBUG_PRINT_STR, $str + jmp $strend +$str: + dz: str +$strend: +ENDMACRO + + +MACRO: dbgprintnumnl num + dbgprintnum num + dbgprintnl +ENDMACRO + +MACRO: dbgprintnum2nl num0, num1 + dbgprintnum2 num0, num1 + dbgprintnl +ENDMACRO + +MACRO: dbgprintstrnl str + dbgprintstr str + dbgprintnl +ENDMACRO -- 2.11.4.GIT