removed legacy map code and movement code
authorLukas Krickl <lukas@krickl.dev>
Sat, 10 Jan 2026 15:57:22 +0000 (16:57 +0100)
committerLukas Krickl <lukas@krickl.dev>
Sat, 10 Jan 2026 15:57:22 +0000 (16:57 +0100)
Added tile defs

13 files changed:
assets
maps/l1.inc
src/actor.s
src/defs.s
src/hram.s
src/levels.s
src/macros.inc
src/map.s
src/player.s
src/tiles.s
src/update.s
src/wram.s
tools/tmx2map.py

diff --git a/assets b/assets
index b557acc9fbec8b8913a546f20efc3cbbb554ff35..7d9051571e7aa6295d9c02bfb59e4769d233ff37 160000 (submodule)
--- a/assets
+++ b/assets
@@ -1 +1 @@
-Subproject commit b557acc9fbec8b8913a546f20efc3cbbb554ff35
+Subproject commit 7d9051571e7aa6295d9c02bfb59e4769d233ff37
index fd8872ccdca00a0f84448dd3672618a0d62c9a21..d1d94f3b76b679d745de84dffcd3de1788ea728b 100644 (file)
@@ -1,17 +1,17 @@
 ; this map was generated by tmx2map.py
 
-.db 0x9, 0xc, 0xc, 0x5, 0x8, 0xc, 0x5, 0x9, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
-.db 0x3, 0x0, 0x0, 0xa, 0xd, 0xc, 0xe, 0x6, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
-.db 0xb, 0xc, 0x4, 0x0, 0xa, 0xd, 0xc, 0xc, 0xc, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
-.db 0xb, 0xc, 0x5, 0x9, 0xc, 0xf, 0xc, 0xc, 0x4, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
-.db 0x3, 0x0, 0xb, 0x6, 0x1, 0xa, 0xc, 0x5, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
-.db 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x0, 0x0
 .db 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
 
index 687686abea02e3446757eed1e42bce2ab5cdc927..3b4a447b490a7288df1d85b00c150ff38e6bdfdf 100644 (file)
@@ -1,44 +1,3 @@
-
-#define ACT_FAR_Y 76
-#define ACT_FAR_X 80
-
-#define ACT_FURTHEST_Y 66
-#define ACT_FURTHEST_X 84
-
-       ; vectors for each direction
-       ; SOUTH, NORTH, WEST, EAST
-       ;       S: Sign bit
-       ;       y: y position
-       ;       x: x position
-       ;       bits:
-       ;     SYYYSXXX
-act_dir_vector:
-.db 0x10 ; SOUTH       
-.db 0x90 ; NORTH
-.db 0x09 ; WEST
-.db 0x01 ; EAST
-       
-       ; reverse direction
-act_dir_reverse:
-       .db NORTH ; SOUTH
-       .db SOUTH ; NORTH
-       .db EAST ; WEST
-       .db WEST ; EAST
-       
-       
-       ; tile flags to check if moving forward based on direction
-act_dir_forward: 
-       .db TF_SE ; SOUTH
-       .db TF_NE ; NORTH
-       .db TF_WE ; WEST
-       .db TF_EE ; EAST
-       
-       ; tile flags to check if moving back based on direction
-act_dir_back:
-       .db TF_NE ; SOUTH
-       .db TF_SE ; NORTH
-       .db TF_EE ; WEST
-       .db TF_WE ; EAST
        
        ; loads an actor table into ram
        ; actors are loaded until the type byte of
@@ -131,7 +90,7 @@ act_r_bat:
        add hl, de
        ld [hl], a
 
-       call act_move_forward
+       ; TODO: move
 
        ret
 
@@ -232,141 +191,6 @@ act_die_clear_tact:
        call act_clear_tact
 
        ret
-
-       
-       ; generic actor table call
-       ; inputs:
-       ;               $1: far, near, furthest
-#macro _act_draw_n
-       ld a, [de] ; type
-       add a, a ; * 2 for offset
-       ld hl, act_draw_$1_table
-       ld b, 0
-       ld c, a
-       add hl, bc
-
-       ; load routine ptr
-       ld a, [hl+]
-       ld h, [hl]
-       ld l, a
-       jp hl
-#endmacro
-
-act_draw_near_table:
-       ; NULL
-       dw act_r_nop
-       ; PLAYER
-       dw act_r_nop
-       ; bat
-       dw act_r_nop
-       
-       ; draws a near actor
-       ; inputs:
-       ;               de: actor
-act_draw_near:
-       _act_draw_n near
-       
-       ; draws a bat actor
-       ; inputs:
-       ;               de: act ptr
-act_draw_far_bat:
-       ld a, 4
-       call oamalloc
-
-       ld a, ACT_FAR_Y
-       ld [hl+], a
-       ld a, ACT_FAR_X
-       ld [hl+], a
-       ld a, 0x92
-       ld [hl+], a
-       xor a, a
-       ld [hl+], a
-
-       ld a, ACT_FAR_Y+8
-       ld [hl+], a
-       ld a, ACT_FAR_X
-       ld [hl+], a
-       ld a, 0xA2
-       ld [hl+], a
-       xor a, a
-       ld [hl+], a
-
-       ld a, ACT_FAR_Y
-       ld [hl+], a
-       ld a, ACT_FAR_X+8
-       ld [hl+], a
-       ld a, 0x93
-       ld [hl+], a
-       xor a, a
-       ld [hl+], a
-
-       ld a, ACT_FAR_Y+8
-       ld [hl+], a
-       ld a, ACT_FAR_X+8
-       ld [hl+], a
-       ld a, 0xA3
-       ld [hl+], a
-       xor a, a
-       ld [hl+], a
-       ret
-
-act_draw_far_table:
-       ; NULL
-       dw act_r_nop
-       ; player
-       dw act_r_nop
-       ; bat
-       dw act_draw_far_bat
-
-       ; draws an actor if they are far
-       ; usuall act_nearby or prop_nearby
-       ; to the camera
-       ; inputs:
-       ;               de: actor ptr
-act_draw_far:
-       _act_draw_n far
-       
-       ; draw a bat actor
-       ; inputs:
-       ;               de: actor ptr
-act_draw_furthest_bat:
-       ld a, 2
-       call oamalloc
-
-       ld a, ACT_FURTHEST_Y
-       ld [hl+], a
-       ld a, ACT_FURTHEST_X
-       ld [hl+], a
-       ld a, 0x91
-       ld [hl+], a
-       xor a, a
-       ld [hl+], a
-
-       ld a, ACT_FURTHEST_Y+8
-       ld [hl+], a
-       ld a, ACT_FURTHEST_X
-       ld [hl+], a
-       ld a, 0xA1
-       ld [hl+], a
-       xor a, a
-       ld [hl], a
-       ret
-
-act_draw_furthest_table:
-       ; NULLL
-       dw act_r_nop
-       ; player
-       dw act_r_nop
-       ; bat
-       dw act_draw_furthest_bat
-       
-       ; draws an actor if they are furthest
-       ; inputs:
-       ;               de: actor ptr
-act_draw_furthest:
-       _act_draw_n furthest
-       
-       ret
        
        ; clears tact at the current actors position
        ; inputs:
@@ -464,262 +288,7 @@ act_set_tprop:
        ld a, e
        ld [hl], a
        ret
-
-       ; checks if the selected actor can move forward
-       ;       inputs:
-       ;               de: actor
-       ;               hl: act_dir_forward or act_dir_back
-       ; returns:
-       ;               zero flag:  -> move not possible
-       ;               not zero flag: -> move possible
-act_can_move:
-       push hl
-
-       ld hl, act_pos_y
-       add hl, de
-
-       ld b, [hl]
-       inc hl
-       ld c, [hl]
-
-       push de
-       call map_get_tile 
-       ; hl = tile
-       ld de, t_flags0
-       add hl, de
-       ld a, [hl] 
-       ld b, a ; b = tile flags
-       pop de
-       
-       ld hl, act_dir
-       add hl, de
-       ld a, [hl]
-       and a, ACT_DIR_MASK
-       ; a = direction
-               
-       ld d, 0
-       ld e, a ; de = direction offset
-       pop hl ; hl = flags table
-       add hl, de
-       ld a, [hl] ; a = required flag
-       
-       and a, b
-
-       ret
-       
-       ; applies a direction vector to the current actor
-       ; inputs:
-       ;               de: actor
-       ;                b: direction vector (SYYYSXXX)
-act_apply_vec:
-       ld hl, act_pos_y
-       add hl, de
-       
-       ld a, b
-       ; extract y direction
-       and a, 0xF0
-       swap a
-
-       ; a = y direction
-       push bc
-       push hl
-       call act_apply_pos
-       pop hl
-       pop bc
-
-       inc hl ; hl = x pos
-       
-       ld a, b
-       and a, 0x0F
-       ; a = x direction
-       call act_apply_pos
-
-       ret
-       
-       ; applies a single position based on its
-       ; sign bit
-       ; inputs:
-       ;               hl: ptr to position 
-       ;    a: 0000SNNN -> vector value
-       ;       preserves: de
-       ; uses hl, bc, af
-act_apply_pos:
-       ; check sign
-       bit 3, a
-       jr z, @nosign REL
-
-       and a, 0b00000111
-       ld b, a
-       ld a, [hl]
-
-       sub a, b
-       ld [hl], a
-
-       ret
-@nosign:
-       and a, 0b00000111
-       ld b, [hl]
-
-       add a, b
-       ld [hl], a
-
-       ret
-       
-       ; creates a copy of the actors position
-       ; in tmp_act_y and _x
-       ; inputs:
-       ;               de: actor
-       ; preverse:
-       ;               de
-_act_backup_pos:
-       ld hl, act_pos_y
-       add hl, de
-       ld a, [hl+]
-       ld [tmp_act_y], a
-       ld a, [hl]
-       ld [tmp_act_x], a
-       ret
-       
-       ; restores actor position 
-       ; from tmp_act_y/x
-       ; unsets act_just_moved
-       ; inputs:
-       ;               de: actor
-       ; preserves:
-       ;               de
-_act_restore_pos:
-       ld hl, act_pos_y
-       add hl, de
-
-       ld a, [tmp_act_y]
-       ld [hl+], a
-       ld a, [tmp_act_x]
-       ld [hl], a
-
-       xor a, a
-       ldh [act_just_moved], a
-       ret
-       
-       ; tests if the new actor location contains
-       ; an actor
-       ; rolls back position to tmp_act_y/x if it does
-       ; input:
-       ;               de: actor
-       ; preserves:
-       ;               de
-_act_check_act_in_location:
-       push de
-       ld hl, act_pos_y
-       add hl, de
-       ld a, [hl+]
-       ld b, a
-       ld c, [hl]
-       call map_get_tile
-       ; hl = tile
-       ld bc, t_act
-       add hl, bc
-
-       ld a, [hl+]
-       or a, [hl]
-       pop de
-       call nz, _act_restore_pos
-       ret
-       
-       
-       ; moves the actor forward
-       ; performs collision checks
-       ; inputs:
-       ;               de: actor
-       ; returns:
-       ;               act_just_moved: 1 -> moved
-       ;               act_just_moved: 0 -> not moved
-act_move_forward:
-       xor a, a
-       ldh [act_just_moved], a
-       call _act_backup_pos
-
-       push de
-       ld hl, act_dir_forward
-       call act_can_move
-       pop de
-       ret z ; bail on collision
-
-       push de
-       call act_clear_tact
-       pop de
-       push de
-
-       ld hl, act_dir
-       add hl, de ; hl = act_dir
-       ld a, [hl]
-       and a, ACT_DIR_MASK
-       ld b, 0
-       ld c, a ; bc = direction offset
-
-       ld hl, act_dir_vector
-       add hl, bc ; hl = direction vector
-       ld b, [hl] ; b = direction
-       
-       call act_apply_vec
-
-       ld a, 1
-       ldh [act_just_moved], a
-
-       ; check if player collides with actor
-       ; at new location
-       pop de
-       call _act_check_act_in_location
-       call act_set_tact
-
-       ret
-       
-       ; moves the actor back
-       ; performs collision checks
-       ; inputs:
-       ;               de: actor
-act_move_back:
-       xor a, a
-       ldh [act_just_moved], a
-       call _act_backup_pos
-
-       push de
-       ld hl, act_dir_back
-       call act_can_move
-       pop de
-       ret z ; bail on collision
-
-       push de
-       call act_clear_tact
-       pop de
-       push de
-
-       ld hl, act_dir
-       add hl, de ; hl = act_dir
-       ld a, [hl]
-       and a, ACT_DIR_MASK
-       ld b, 0
-       ld c, a ; bc = direction offset
-       
-       ; get reverse direction
-       ld hl, act_dir_reverse
-       add hl, bc
-       ld c, [hl] ; bc = reverse offset
-
-
-       ld hl, act_dir_vector
-       add hl, bc ; hl = direction vector
-       ld b, [hl] ; b = direction
-
-       call act_apply_vec
-
-       ld a, 1
-       ldh [act_just_moved], a
-
-       pop de
-       call _act_check_act_in_location
-       call act_set_tact
        
-       ret
        
        ; performs an attack
        ; depends on the weapon equipped, 
index 4c9cdd8e5c854bbb34e591e020ee69bde1131f52..91c5aa14c5200147bed80db23c946e81929493e5 100644 (file)
        ; ptr to actor table for this map
        ; acto tables are terminated with a 0 type actor
 .de map_acts, 2
-       ; ptr to tile props
-       ; tile props are modifiers that are applied to tiles after 
-       ; the load takes place
-       ; the map_tp list is terminated by a 0 type
-.de map_tile_props, 2
   ; pointers to tile banks to be loaded 
   ; maps to map property tile_bank0, tile_bank1, tile_bank2, tile_bank3
   ; note that tile_bank1 and tile_bank2 are 128 bytes each
 
        ; tile type enum
 .se 0
-.de TT_EMPTY, 1
-.de TT_OPEN, 1
-
-       ; tile p0 for TT_LOCKED
-       ; 0000nnnn: direction bits locked door (TF_SE, NE, WE, SE)
-       ; nnnn0000: lock level (0-15)
-.de TT_LOCKED, 1
-
-.de TT_WATER, 1
-.de TT_WATER_DEEP, 1
-       
-       ; tile p0 for TT_LAVA
-       ; 0000nnnn: damage level
-.de TT_LAVA, 1
+.de TT_NONE, 1
+.de TT_WALL, 1
+.de TT_DOOR, 1
 
 
        ; tile flags0
 .se 1
-       ; SOUTH EXIT
-.de TF_SE, 1
-       ; NORTH EXIT
-.de TF_NE, 2
-       ; WEST EXIT
-.de TF_WE, 4
-       ; EAST EXIT
-.de TF_EE, 8
+       ; cannot be walked through
+.de TF0_WALL, 1
+       ; the tile can be seen (should be rendered)
+.de TF0_VSIBLE, 1
 
 
        ; tile struct
index fe3a90e3b3a1b5e743be86eddaee689339050f26..472ea3dec91a01e4a3f7eb878d7210da631b0327 100644 (file)
@@ -3,7 +3,3 @@
 ; 0x80 - 0x90 are used by dma routines
 .org 0xFF90
 
-       ; this flag is set to 1
-       ; by move forward or back
-       ; to indicate a move occured
-act_just_moved: .adv 1
index c63ed87e53871f6a6cdc51f1c08bb49eb9a2e19f..14d473cbc419cf86543e89103be0356ec2c237a5 100644 (file)
@@ -9,7 +9,7 @@
        ; where each tile has values and its current state. The map can be drawn from this.
 
 l1:
-       mapdef MAP_F_DO_FULL_REDRAW, map_r_nop, l1_acts, l1_tile_props, tile_banks_default 
+       mapdef MAP_F_DO_FULL_REDRAW, map_r_nop, l1_acts, tile_banks_default 
 #include "l1.inc"
        
        ; l1 actor table
@@ -17,16 +17,6 @@ l1_acts:
        actdef ACT_T_BAT, 0, 4, 6, 2, 1, ITEM_NONE, ITEM_NONE, ITEM_NONE, attr_bat
        actdef ACT_T_BAT, 0, 0, 2, 2, 1, ITEM_NONE, ITEM_NONE, ITEM_NONE, attr_bat
        .db 0 ; terminate
-       
-l1_tile_props:
-       maptpdef TT_LOCKED,\
-               1,\
-               0,\
-               0,\
-               0,\
-               (1 << 4) | TF_SE
-
-       .db 0 ; terminate
 
 tile_banks_default:
        dw bank8000
index 5bec09218a061311d7b1fc18a9eca3e37d5e4254..2e05e7f13d12749debba1932ee62b476bea78979 100644 (file)
@@ -155,14 +155,12 @@ $1:
        ;               $1: flags
        ;               $2: map routine
        ;               $3: actors
-       ;               $4: map tile props
        ;               $5: tile bank table
 #macro mapdef
        .db $1
        dw $2
        dw $3
        dw $4
-       dw $5
 #endmacro
 
        ; define a map tile prop entry
index 9ceaa7c52e6dd459ff71bb64d15c42255440568e..b81a11386410e4c3fc90ac21f0f9274f8f9d7b40 100644 (file)
--- a/src/map.s
+++ b/src/map.s
@@ -63,17 +63,7 @@ map_settings_load:
        ld h, [hl]
        ld l, a
        call act_table_load
-
-       pop de
        
-       ; load tile props
-       ld hl, map_tile_props
-       add hl, de
-       ld a, [hl+]
-       ld h, [hl]
-       ld l, a
-       call map_load_tile_props
-       push de
        
        ; init the player
        ld de, player
@@ -82,15 +72,6 @@ map_settings_load:
        pop de
        ret
        
-       ; applies tile props to a map
-       ; requires tiles to be loaded
-       ; applies tile props to all tiles until 
-       ; type 0 is read
-       ; inputs:
-       ;               hl: tile prop ptr
-map_load_tile_props:
-       ret
-       
        ; loads a tile buffer
        ; tile buffers from maped only contain tile flags 
        ; into the tile buffer
@@ -259,214 +240,6 @@ map_full_draw_oam_clear:
        call OAMDMAFN
        ret
 
-       ; direction vector templates
-       ;       for each direction
-       ; y/x coordinates
-_dir_vectors_east:
-       ; forward
-       .db 0, 1
-       ; back
-       .db 0, -1
-       ; left
-       .db -1, 0
-       ; right
-       .db 1, 0
-
-_dir_vectors_west:
-       ; forward
-       .db 0, -1
-       ; back
-       .db 0, 1
-       ; left
-       .db 1, 0
-       ; right
-       .db -1, 0
-
-_dir_vectors_north:
-       ; forward
-       .db -1, 0
-       ; back
-       .db 1, 0
-       ; left
-       .db 0, -1
-       ; right
-       .db 0, 1
-
-_dir_vectors_south:
-       ; forward
-       .db 1, 0
-       ; back
-       .db -1, 0
-       ; left
-       .db 0, 1
-       ; right
-       .db 0, -1
-
-_dir_tf_south:
-       ; forward
-.db TF_SE
-       ; back
-.db TF_NE
-       ; left
-.db TF_EE
-       ; right
-.db TF_WE
-
-_dir_tf_north:
-       ; forward
-.db TF_NE
-       ; back
-.db TF_SE
-       ; left
-.db TF_WE
-       ; right
-.db TF_EE
-
-_dir_tf_west:
-       ; forward
-.db TF_WE
-       ; back
-.db TF_EE
-       ; left
-.db TF_SE
-       ; right
-.db TF_NE
-
-_dir_tf_east:
-       ; forward
-.db TF_EE
-       ; back
-.db TF_WE
-       ; left
-.db TF_NE
-       ; right
-.db TF_SE
-
-       ; loads the marching vector
-       ; as well as player positin
-       ; inputs:
-       ;               de: actor ptr
-       ;               $1: vector to load
-       ;       returns:
-       ;               b/c: player y/x
-       ;               d/e: chosen vector
-#macro map_load_march_vec
-       ld hl, act_pos_y
-       add hl, de
-       ld a, [hl+]
-       ld b, a
-       ld a, [hl]
-       ld c, a
-
-       ld a, [$1]
-       ld d, a
-       ld a, [$1+1]
-       ld e, a
-#endmacro
-
-
-       ; gets a tile based on a positon
-       ; and a marching vector
-       ; inputs:
-       ;               b/c: y/x origin
-       ;               d/e: marching vector
-       ;                 a: amount of steps to take
-       ;       returns:
-       ;               tile at b/c + a * d/e
-map_get_tile_march:
-@loop:
-               push af
-               ld a, b
-               add a, d
-               ld b, a ; add vec to b
-               
-               ld a, c
-               add a, e
-               ld c, a ; add vec to c
-
-               pop af
-               dec a
-               jr nz, @loop REL
-       jp map_get_tile
-
-
-       ; gets the direction vector
-       ; for the current direction
-       ; copies to common wram location
-       ; inputs:
-       ;               a: direction
-       ;       returns:
-       ;               dir_vector: set for all directions
-       ;               dir_tf: sets direction flags
-map_get_dir_vectors:
-       cp a, SOUTH
-       jp z, @south
-
-       cp a, NORTH
-       jp z, @north
-       
-       cp a, WEST
-       jp z, @west
-       
-       ; default case east
-@east:
-       ld de, _dir_vectors_east
-       ld hl, dir_vectors
-       ld bc, dv_size
-       call memcpy 
-
-       ld de, _dir_tf_east
-       ld hl, dir_tfs
-       ld bc, dir_tfs_end - dir_tfs
-       jp memcpy
-
-@south:
-       ld de, _dir_vectors_south
-       ld hl, dir_vectors
-       ld bc, dv_size
-       call memcpy 
-
-       ld de, _dir_tf_south
-       ld hl, dir_tfs
-       ld bc, dir_tfs_end - dir_tfs
-       jp memcpy
-
-@north:
-       ld de, _dir_vectors_north
-       ld hl, dir_vectors
-       ld bc, dv_size
-       call memcpy 
-
-       ld de, _dir_tf_north
-       ld hl, dir_tfs
-       ld bc, dir_tfs_end - dir_tfs
-       jp memcpy
-@west: 
-       ld de, _dir_vectors_west
-       ld hl, dir_vectors
-       ld bc, dv_size
-       call memcpy
-
-       ld de, _dir_tf_west
-       ld hl, dir_tfs
-       ld bc, dir_tfs_end - dir_tfs
-       jp memcpy
-
-       ; draws a static ceiling from the map buffer
-map_full_draw_ceiling:
-       ld hl, render_buffer
-       ld bc, RENDER_BUF_W * 5
-       ld d, 0x01
-       ; set ceiling tile for 4 rows
-       jp memset
-
-       ; draws floor tiles
-map_full_draw_floor:
-       ld hl, render_buffer + RENDER_BUF_W * 5
-       ld bc, RENDER_BUF_W * 9
-       ld d, 0x02
-       jp memset
-       
 
 
        
@@ -480,17 +253,6 @@ map_full_draw_floor:
        ;               render_buffer: new map data to be drawn
        ; transferts to redraw state
 map_full_draw:
-       
-       ; 1) get player direction vecors
-       ld a, [player+act_dir]
-       and a, ACT_DIR_MASK
-       call map_get_dir_vectors
-
-       ; 2) draw back to front
-       call map_full_draw_ceiling
-       call map_full_draw_floor
-
-
 @done:
        call minimap_full_draw
 
index 70f716908e2e035370ceaa876b494e1877f7a88a..a004581fdd3e8458c8d6729edcf0249cada4926a 100644 (file)
@@ -83,40 +83,6 @@ player_update:
        
        ; player attack call
 player_attack:
-       ld de, player
-       ld a, player HI
-       ld [combat+combat_src_act], a
-       ld a, player LO
-       ld [combat+combat_src_act+1], a
-       
-       ; TODO: implement correctly
-       ; for now just remove an actor if
-       ; they are near
-
-       ; TODO: check if player can reach tile
-       
-       ld de, player
-       map_load_march_vec dir_vector_forward
-       ld a, 1 ; one forward
-       call map_get_tile_march
-       ld de, t_act
-       add hl, de
-
-       ld a, [hl+]
-       ld [combat+combat_dst_act], a
-       ld a, [hl]
-       ld [combat+combat_dst_act+1], a
-       
-       ; for now just die if actor != NULL
-       ld a, [combat+combat_dst_act]
-       ld d, a
-       ld a, [combat+combat_dst_act+1]
-       ld e, a
-       or a, d
-       ret z
-
-       call act_die
-
        ret
        
        ; moves the player 
@@ -132,77 +98,21 @@ player_handle_move:
 
        ld b, DIRLEFT
        input_just
-       jr z, @not_left REL
-               ld hl, player_direction_turn_left
-               ld a, [player+act_dir]
-               and a, ACT_DIR_MASK
-               ld d, 0
-               ld e, a
-               add hl, de ; hl = direction table offset
-
-               ld b, [hl] ; new direction
-               ld a, [player+act_dir]
-               and a, ~ACT_DIR_MASK & 0xFF
-               or a, b
-               ld [player+act_dir], a
-
-               call map_full_draw_oam_clear
-               call map_full_draw
 @not_left:
 
        ld b, DIRRIGHT
        input_just
        jr z, @not_right REL
-               ld hl, player_direction_turn_right
-               ld a, [player+act_dir]
-               and a, ACT_DIR_MASK
-               ld d, 0
-               ld e, a
-               add hl, de ; hl = direction table offset
-
-               ld b, [hl] ; new direction
-               ld a, [player+act_dir]
-               and a, ~ACT_DIR_MASK & 0xFF
-               or a, b
-               ld [player+act_dir], a
-
-               call map_full_draw_oam_clear
-               call map_full_draw
 @not_right:
 
        ld b, DIRUP
        input_just
        jr z, @not_up REL
-               call player_move_forward
 @not_up:
 
        ld b, DIRDOWN
        input_just
        jr z, @not_down REL
-               call nz, player_move_back
 @not_down:
        ret
        
-       ; called on successful move
-player_on_move:
-       call act_update_all
-       call play_walk_noise
-       ret
-
-player_move_forward:
-       ld de, player
-       call act_move_forward
-
-       ldh a, [act_just_moved]
-       cp a, 1
-       call z, player_on_move
-       jp map_full_draw
-
-player_move_back:
-       ld de, player
-       call act_move_back
-
-       ldh a, [act_just_moved]
-       cp a, 1
-       call z, player_on_move
-       jp map_full_draw
index 929378af8697829bf3d331787796be256f0cd6d2..d98180e706aeee646d43a442bbf7140df6edff44 100644 (file)
@@ -3,39 +3,21 @@
        
        ; fallback tile 
 tile_null:
-       tiledef 0, 0, 0, 0
+       tiledef TT_NONE, TF0_WALL, 0, 0
 
-       ; copies a row of tiles
-       ; from a linear buffer into a new block
-       ; blocks must be 4 tiles wide
-       ; inputs:
-       ;               hl: destination
-       ;               de: source
-       ;               bc: row offset
-       ;               a: rows
-tiles_block_copy:
-@loop: 
-       push af
+tile_wall:
+       tiledef TT_WALL, TF0_WALL, 0, 0
 
-       ld a, [de]
-       inc de
-       ld [hl+], a
+tile_floor:
+       tiledef TT_NONE, 0, 0, 0
 
-       ld a, [de]
-       inc de
-       ld [hl+], a
+tile_door:
+       tiledef TT_DOOR, TF0_WALL, 0, 0
 
-       ld a, [de]
-       inc de
-       ld [hl+], a
+       ; table of map tiles -> actual tile defs
+tile_table:
+       dw tile_wall
+       dw tile_floor
+       dw tile_door
 
-       ld a, [de]
-       inc de
-       ld [hl+], a
 
-       add hl, bc
-
-       pop af
-       dec a
-       jr nz, @loop REL
-       ret
index 8a3518e5c4d7c3030166693ca8fe219dca6f703c..44204c37d5b84af0e5c03d1788f2feb40f56fb04 100644 (file)
@@ -1,52 +1,5 @@
 update_game_over:
   ret
-       
-       ; draws an actor
-       ; forward direction only
-       ; inputs:
-       ;               $1: steps
-       ;               $2: near/far/furthest actor draw routine
-#macro _update_game_draw_act
-       ; draw actors and props
-       ; on nearby tiles
-       ; if the ptr is not NULL
-       ld de, player
-       map_load_march_vec dir_vector_forward
-       ld a, $1
-       call map_get_tile_march
-       ; hl = tile far
-       push hl
-       
-       ; load t_act
-       ld de, t_act
-       add hl, de
-       ld a, [hl+]
-       ld e, [hl]
-       ld d, a
-       or a, e ; check if it is null
-       call nz, act_draw_$2
-       pop hl
-       push hl
-       
-       ; load t_prop
-       ld de, t_prop
-       add hl, de
-       ld a, [hl+]
-       ld e, [hl]
-       ld d, a
-       or a, e ; check if it is null
-       call nz, act_draw_$2
-
-       pop hl
-       ; check if we can go forward one more time
-       ; if not jump to @done_act_draw
-       ld de, t_flags0
-       add hl, de
-       ld b, [hl]
-       ld a, [dir_tf_forward]
-       and a, b
-       jp z, @done_act_draw
-#endmacro
 
 update_game:
   ; clear oam
@@ -61,17 +14,6 @@ update_game:
        call rand
 
        call ui_update
-
-       
-       ; draws visible act and props
-       ; for the current frame
-update_game_draw_act_and_prop:
-       ; TODO: update map routine
-
-       _update_game_draw_act 0, near
-       _update_game_draw_act 1, far
-       _update_game_draw_act 2, furthest
-@done_act_draw:
   ret
 
        
index 300aa2353c486bbba11e24c64f6c3d3ad0da70ac..717fdad5e9811eabb69635eb83b74ae4e3ff34f1 100644 (file)
@@ -106,32 +106,6 @@ update_tile_vram: .adv 2
 update_tile_ptr: .adv 2
 
 minimap_buffer: .adv 9
-
-       ; tmeporary actor position backup
-tmp_act_y: .adv 1
-tmp_act_x: .adv 1
-       
-       ; current tile direction vector
-       ; y and x direction 
-       ; this can be used to get all tiles ahead
-       ; by moving in the direction
-       ; mainly used for player attack direction and
-       ; rendering the first person view
-dir_vectors:
-dir_vector_forward: .adv 2
-dir_vector_back: .adv 2
-dir_vector_left: .adv 2
-dir_vector_right: .adv 2
-dir_vectors_end:
-
-       ; direction tile flags 
-       ; for rendering
-dir_tfs:
-dir_tf_forward: .adv 1
-dir_tf_back: .adv 1
-dir_tf_left: .adv 1
-dir_tf_right: .adv 1
-dir_tfs_end:
        
        ; combat data
 combat: .adv combat_size
index 4b1c9c637c68a9b69db13936bfb0ae03561d30ce..e78eaf43122be7837e34b289493a8c2b3f69a397 100755 (executable)
@@ -13,7 +13,7 @@ if len(sys.argv) < 2:
 
 src = sys.argv[1]
 
-tile_offset = 97
+tile_offset = 1
 
 if len(sys.argv) > 2:
        tile_offset = int(sys.argv[2])