mirror of
https://github.com/Pixinn/rogue-like.git
synced 2024-06-01 12:41:29 +00:00
Bugfix: bresenham when uniting rooms
This commit is contained in:
parent
4da93af1cb
commit
abbd59fd9e
BIN
escape.dsk
BIN
escape.dsk
Binary file not shown.
|
@ -82,8 +82,8 @@ choice_size_maze:
|
||||||
tst_tiny:
|
tst_tiny:
|
||||||
cmp #$C1
|
cmp #$C1
|
||||||
bne tst_small
|
bne tst_small
|
||||||
ldx #16
|
ldx #20
|
||||||
ldy #16
|
ldy #20
|
||||||
rts
|
rts
|
||||||
tst_small:
|
tst_small:
|
||||||
cmp #$C2
|
cmp #$C2
|
||||||
|
|
|
@ -365,8 +365,8 @@ Unite_Rooms:
|
||||||
.define DELTA_Y ZERO_5_3
|
.define DELTA_Y ZERO_5_3
|
||||||
.define DELTA_X_2 ZERO_5_5
|
.define DELTA_X_2 ZERO_5_5
|
||||||
.define DELTA_Y_2 ZERO_5_6
|
.define DELTA_Y_2 ZERO_5_6
|
||||||
.define ROOM_Y ZERO_7_1
|
.define ROOM_Y ZERO_8_1
|
||||||
.define ROOM_X ZERO_7_2
|
.define ROOM_X ZERO_8_2
|
||||||
.define D ZERO_3
|
.define D ZERO_3
|
||||||
.define ROOM_FOUND SAVE_X
|
.define ROOM_FOUND SAVE_X
|
||||||
_Connect_Room:
|
_Connect_Room:
|
||||||
|
@ -374,7 +374,7 @@ _Connect_Room:
|
||||||
; d = 0
|
; d = 0
|
||||||
lda #0
|
lda #0
|
||||||
sta D
|
sta D
|
||||||
|
|
||||||
; delta_y = zone1_y - room->y
|
; delta_y = zone1_y - room->y
|
||||||
ldx ROOM_FOUND
|
ldx ROOM_FOUND
|
||||||
lda Rooms, X
|
lda Rooms, X
|
||||||
|
@ -403,6 +403,7 @@ _Connect_Room:
|
||||||
sta DELTA_X
|
sta DELTA_X
|
||||||
end_abs_x:
|
end_abs_x:
|
||||||
; int dx2 = 2 * dx
|
; int dx2 = 2 * dx
|
||||||
|
lda DELTA_X
|
||||||
asl
|
asl
|
||||||
sta DELTA_X_2
|
sta DELTA_X_2
|
||||||
|
|
||||||
|
@ -416,6 +417,7 @@ _Connect_Room:
|
||||||
sta DELTA_Y
|
sta DELTA_Y
|
||||||
end_abs_y:
|
end_abs_y:
|
||||||
; int dy2 = 2 * dy
|
; int dy2 = 2 * dy
|
||||||
|
lda DELTA_Y
|
||||||
asl
|
asl
|
||||||
sta DELTA_Y_2
|
sta DELTA_Y_2
|
||||||
|
|
||||||
|
@ -470,6 +472,18 @@ _Connect_Room:
|
||||||
bcc d_infequal_dx
|
bcc d_infequal_dx
|
||||||
beq d_infequal_dx
|
beq d_infequal_dx
|
||||||
; if (d > dx)
|
; if (d > dx)
|
||||||
|
; if (*ptr_room != zone_nr && *ptr_room <= WALKABLE) break;
|
||||||
|
lda (PTR_ROOM), Y ; Y = 0
|
||||||
|
cmp ZONE_NR
|
||||||
|
beq continue_1a
|
||||||
|
cmp #ACTORS::WALKABLE
|
||||||
|
beq end
|
||||||
|
bpl continue_1a
|
||||||
|
jmp end
|
||||||
|
continue_1a:
|
||||||
|
; *ptr_room = zone_nr
|
||||||
|
lda ZONE_NR
|
||||||
|
sta (PTR_ROOM), Y ; Y = 0
|
||||||
; ptr_room += iy
|
; ptr_room += iy
|
||||||
patch_iy1:
|
patch_iy1:
|
||||||
ADD16 PTR_ROOM, #WIDTH_WORLD
|
ADD16 PTR_ROOM, #WIDTH_WORLD
|
||||||
|
@ -482,15 +496,25 @@ _Connect_Room:
|
||||||
; if (*ptr_room != zone_nr && *ptr_room <= WALKABLE) break;
|
; if (*ptr_room != zone_nr && *ptr_room <= WALKABLE) break;
|
||||||
lda (PTR_ROOM), Y ; Y = 0
|
lda (PTR_ROOM), Y ; Y = 0
|
||||||
cmp ZONE_NR
|
cmp ZONE_NR
|
||||||
beq continue_1
|
beq continue_1b
|
||||||
cmp #ACTORS::WALKABLE
|
cmp #ACTORS::WALKABLE
|
||||||
beq end
|
beq end
|
||||||
bpl continue_1
|
bpl continue_1b
|
||||||
jmp end
|
jmp end
|
||||||
continue_1:
|
continue_1b:
|
||||||
lda ZONE_NR
|
lda ZONE_NR
|
||||||
sta (PTR_ROOM), Y ; Y = 0
|
sta (PTR_ROOM), Y ; Y = 0
|
||||||
jmp while_1
|
jmp while_1
|
||||||
|
|
||||||
|
; end label in the middle to be reachable by the branches
|
||||||
|
end:
|
||||||
|
|
||||||
|
; flood fills works on ptr_tile
|
||||||
|
ldx #(ZONE_0 + 1)
|
||||||
|
lda ZONE_NR
|
||||||
|
jsr _Flood_Fill
|
||||||
|
rts
|
||||||
|
|
||||||
dy_sup:
|
dy_sup:
|
||||||
while_2:
|
while_2:
|
||||||
; ptr_room += iy
|
; ptr_room += iy
|
||||||
|
@ -504,8 +528,20 @@ _Connect_Room:
|
||||||
cmp DELTA_Y
|
cmp DELTA_Y
|
||||||
bcc d_infequal_dy
|
bcc d_infequal_dy
|
||||||
beq d_infequal_dy
|
beq d_infequal_dy
|
||||||
;if (d > dy) {
|
; if (d > dy) {
|
||||||
;ptr_room += ix;
|
; if (*ptr_room != zone_nr && *ptr_room <= WALKABLE) break;
|
||||||
|
lda (PTR_ROOM), Y ; Y = 0
|
||||||
|
cmp ZONE_NR
|
||||||
|
beq continue_2a
|
||||||
|
cmp #ACTORS::WALKABLE
|
||||||
|
beq end
|
||||||
|
bpl continue_2a
|
||||||
|
jmp end
|
||||||
|
continue_2a:
|
||||||
|
; *ptr_room = zone_nr
|
||||||
|
lda ZONE_NR
|
||||||
|
sta (PTR_ROOM), Y ; Y = 0
|
||||||
|
; ptr_room += ix;
|
||||||
patch_ix2:
|
patch_ix2:
|
||||||
ADD16 PTR_ROOM, #1
|
ADD16 PTR_ROOM, #1
|
||||||
; d -= dy2
|
; d -= dy2
|
||||||
|
@ -517,21 +553,12 @@ _Connect_Room:
|
||||||
; (*ptr_room != zone_nr && *ptr_room <= WALKABLE)
|
; (*ptr_room != zone_nr && *ptr_room <= WALKABLE)
|
||||||
lda (PTR_ROOM), Y ; Y = 0
|
lda (PTR_ROOM), Y ; Y = 0
|
||||||
cmp ZONE_NR
|
cmp ZONE_NR
|
||||||
beq continue_2
|
beq continue_2b
|
||||||
cmp #ACTORS::WALKABLE
|
cmp #ACTORS::WALKABLE
|
||||||
beq end
|
beq end
|
||||||
bpl continue_2
|
bpl continue_2b
|
||||||
jmp end
|
jmp end
|
||||||
continue_2:
|
continue_2b:
|
||||||
lda ZONE_NR
|
lda ZONE_NR
|
||||||
sta (PTR_ROOM), Y ; Y = 0
|
sta (PTR_ROOM), Y ; Y = 0
|
||||||
jmp while_2
|
jmp while_2
|
||||||
end:
|
|
||||||
|
|
||||||
; flood fills works on ptr_tile
|
|
||||||
ldx #(ZONE_0 + 1)
|
|
||||||
lda ZONE_NR
|
|
||||||
jsr _Flood_Fill
|
|
||||||
|
|
||||||
|
|
||||||
rts
|
|
|
@ -67,13 +67,13 @@ _main:
|
||||||
jsr Title ; will init the seed
|
jsr Title ; will init the seed
|
||||||
|
|
||||||
; overwrite the seed to debug
|
; overwrite the seed to debug
|
||||||
; lda #$E6
|
; lda #$55
|
||||||
; sta SEED0
|
; sta SEED0
|
||||||
; lda #$CE
|
; lda #$67
|
||||||
; sta SEED1
|
; sta SEED1
|
||||||
; lda #$AD
|
; lda #$8C
|
||||||
; sta SEED2
|
; sta SEED2
|
||||||
; lda #$03
|
; lda #$5F
|
||||||
; sta SEED3
|
; sta SEED3
|
||||||
jsr Random8_Init
|
jsr Random8_Init
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ world_set_player:
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; Destroys ZERO_2_1, ZERO_2_2 and ZERO_2_3
|
; Destroys ZERO_2_1, ZERO_2_2, ZERO_2_3 ZERO_7_1 and ZERO_7_2
|
||||||
Compute_Maze_Addr:
|
Compute_Maze_Addr:
|
||||||
|
|
||||||
stx COORD_X
|
stx COORD_X
|
||||||
|
|
Loading…
Reference in New Issue
Block a user