mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-02-27 15:29:47 +00:00
mist: tower rotation picture lines
not perfect line drawing but I don't care enough to make it perfect it seems
This commit is contained in:
parent
5f8bedcf4e
commit
9180e02dd1
@ -50,6 +50,7 @@ mist_title.o: mist_title.s zp.inc hardware.inc common_defines.inc \
|
||||
gr_copy.s gr_offsets.s gr_pageflip.s gr_putsprite_crop.s \
|
||||
text_print.s gr_fast_clear.s decompress_fast_v2.s \
|
||||
keyboard.s draw_pointer.s end_level.s audio.s \
|
||||
init_state.s \
|
||||
link_book_mist_dock.s common_sprites.inc leveldata_title.inc
|
||||
ca65 -o mist_title.o mist_title.s -l mist_title.lst
|
||||
|
||||
@ -88,6 +89,7 @@ octagon.o: octagon.s zp.inc hardware.inc common_defines.inc \
|
||||
draw_pointer.s \
|
||||
end_level.s \
|
||||
octagon_bookshelf.s \
|
||||
octagon_rotation.s \
|
||||
gr_copy.s audio.s text_print.s decompress_fast_v2.s
|
||||
ca65 -o octagon.o octagon.s -l octagon.lst
|
||||
|
||||
|
@ -51,4 +51,9 @@ init_state:
|
||||
sta VIEWER_CHANNEL
|
||||
sta VIEWER_LATCHED
|
||||
|
||||
sta TOWER_ROTATION
|
||||
|
||||
lda #$ff ; for debugging
|
||||
sta MARKER_SWITCHES
|
||||
|
||||
rts
|
||||
|
@ -134,7 +134,7 @@ location6:
|
||||
.byte $ff ; north exit_dir
|
||||
.byte $ff ; south exit_dir
|
||||
.byte $ff ; east exit_dir
|
||||
.byte DIRECTION_W ; west exit_dir
|
||||
.byte DIRECTION_W|DIRECTION_SPLIT ; west exit_dir
|
||||
.word $0000 ; north bg
|
||||
.word $0000 ; south bg
|
||||
.word $0000 ; east bg
|
||||
@ -233,7 +233,10 @@ location11:
|
||||
.word $0000 ; east bg
|
||||
.word tower_rotation_lzsa ; west bg
|
||||
.byte BG_WEST
|
||||
.byte $ff
|
||||
.byte DIRECTION_W
|
||||
.byte 28,33 ; special x
|
||||
.byte 14,22 ; special y
|
||||
.word rotate_tower-1 ; special function
|
||||
|
||||
; OCTAGON_BOOKSHELF_CLOSE -- the bookcase close in
|
||||
location12:
|
||||
|
@ -60,6 +60,13 @@ game_loop:
|
||||
; handle special-case forground logic
|
||||
;====================================
|
||||
|
||||
; things always happening
|
||||
lda LOCATION
|
||||
cmp #OCTAGON_TOWER_ROTATION
|
||||
beq animate_tower_rotation
|
||||
|
||||
; things only happening when animating
|
||||
|
||||
lda ANIMATE_FRAME
|
||||
beq nothing_special
|
||||
|
||||
@ -91,6 +98,10 @@ animate_elevator:
|
||||
jsr animate_elevator_ride
|
||||
jmp nothing_special
|
||||
|
||||
animate_tower_rotation:
|
||||
jsr handle_tower_rotation
|
||||
jmp nothing_special
|
||||
|
||||
nothing_special:
|
||||
|
||||
;====================================
|
||||
@ -264,6 +275,8 @@ done_goto:
|
||||
|
||||
.include "octagon_bookshelf.s"
|
||||
|
||||
.include "octagon_rotation.s"
|
||||
|
||||
; linking books
|
||||
|
||||
; letters
|
||||
|
@ -290,8 +290,12 @@ door_swirl:
|
||||
|
||||
|
||||
cant_noise:
|
||||
ldx #$50
|
||||
ldx #$ff
|
||||
cant_noise_loop:
|
||||
bit $c030
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
bit $c030
|
||||
nop
|
||||
nop
|
||||
|
214
mist/octagon_rotation.s
Normal file
214
mist/octagon_rotation.s
Normal file
@ -0,0 +1,214 @@
|
||||
; clickd on map, rotate the tower
|
||||
rotate_tower:
|
||||
|
||||
ldy TOWER_ROTATION
|
||||
iny
|
||||
cpy #10
|
||||
bcc done_rotate_tower
|
||||
|
||||
ldy #0
|
||||
|
||||
done_rotate_tower:
|
||||
sty TOWER_ROTATION
|
||||
|
||||
rts
|
||||
|
||||
|
||||
|
||||
handle_tower_rotation:
|
||||
; draw sprites based on background
|
||||
; only needs to be done once?
|
||||
|
||||
jsr draw_tower_line
|
||||
|
||||
rts
|
||||
|
||||
|
||||
|
||||
draw_tower_line:
|
||||
|
||||
; set color
|
||||
ldy TOWER_ROTATION
|
||||
ldx line_colors,Y
|
||||
|
||||
cpx #$77
|
||||
beq color_good
|
||||
|
||||
lda MARKER_SWITCHES
|
||||
line_gears:
|
||||
cpy #ROTATION_GEARS
|
||||
bne line_dock
|
||||
and #MARKER_GEARS
|
||||
beq white_line
|
||||
bne red_line
|
||||
|
||||
line_dock:
|
||||
cpy #ROTATION_DOCK
|
||||
bne line_tree
|
||||
and #MARKER_DOCK
|
||||
beq white_line
|
||||
bne red_line
|
||||
|
||||
line_tree:
|
||||
cpy #ROTATION_TREE
|
||||
bne line_spaceship
|
||||
and #MARKER_TREE
|
||||
beq white_line
|
||||
bne red_line
|
||||
|
||||
line_spaceship:
|
||||
and #MARKER_SPACESHIP
|
||||
beq white_line
|
||||
|
||||
red_line:
|
||||
ldx #$11
|
||||
bne color_good
|
||||
white_line:
|
||||
ldx #$77
|
||||
color_good:
|
||||
stx plot_color+1
|
||||
|
||||
; get initial position (30 x 20)
|
||||
|
||||
ldy #(30*2)
|
||||
sty CH
|
||||
|
||||
lda #(20*4)
|
||||
sta CV
|
||||
|
||||
tower_line_loop:
|
||||
|
||||
; check x bounds
|
||||
|
||||
ldy CH
|
||||
cpy #(8*2)
|
||||
bcc done_tower_line
|
||||
cpy #(34*2)
|
||||
bcs done_tower_line
|
||||
|
||||
; check y bounds
|
||||
lda CV
|
||||
cmp #(6*4)
|
||||
bcc done_tower_line
|
||||
cmp #(40*4)
|
||||
bcs done_tower_line
|
||||
|
||||
jsr plot_point
|
||||
|
||||
; update X
|
||||
|
||||
lda CH
|
||||
clc
|
||||
ldy TOWER_ROTATION
|
||||
adc xslopes,Y
|
||||
sta CH
|
||||
|
||||
; update Y
|
||||
lda CV
|
||||
clc
|
||||
adc yslopes,Y
|
||||
sta CV
|
||||
|
||||
jmp tower_line_loop
|
||||
|
||||
done_tower_line:
|
||||
|
||||
rts
|
||||
|
||||
|
||||
; turn on double high point at CH,CV
|
||||
plot_point:
|
||||
lda CV ; y
|
||||
lsr
|
||||
lsr
|
||||
and #$fe ; make even
|
||||
tax
|
||||
lda gr_offsets,X
|
||||
sta OUTL
|
||||
|
||||
lda gr_offsets+1,X
|
||||
clc
|
||||
adc DRAW_PAGE
|
||||
sta OUTH
|
||||
|
||||
lda CH ; X * 2
|
||||
lsr
|
||||
tay
|
||||
|
||||
plot_color:
|
||||
lda #$77
|
||||
sta (OUTL),Y
|
||||
|
||||
rts
|
||||
|
||||
|
||||
; rotations (10)
|
||||
|
||||
; for each y increment/decrement, how much X to change
|
||||
|
||||
|
||||
|
||||
xslopes:
|
||||
.byte 1 ; (1,0) yslope=0
|
||||
.byte 1 ; (1,2) yslope=2
|
||||
.byte $ff ; (-1,4) yslope=4
|
||||
.byte $ff ; (-1,1) yslope=1
|
||||
.byte $ff ; (-1,0.5) yslope=0.5
|
||||
.byte $ff ; (-1,0.2) yslope=0.2
|
||||
.byte $ff ; (-1,-0.5) yslope=-0.5
|
||||
.byte $ff ; (-1,-1) yslope=-1
|
||||
.byte $ff ; (-1,-4) yslope=-4
|
||||
.byte 1 ; ( 1,-2) yslope=-2
|
||||
|
||||
; 6.2 fixed point
|
||||
|
||||
|
||||
yslopes:
|
||||
.byte $00 ; (1,0) yslope=0 00000.00
|
||||
.byte $08 ; (1,2) yslope=2 00010.00
|
||||
.byte $10 ; (-1,4) yslope=4 00100.00
|
||||
.byte $04 ; (-1,1) yslope=1 00001.00
|
||||
.byte $02 ; (-1,0.5) yslope=0.5 00000.10
|
||||
.byte $00 ; (-1,0.2) yslope=0.2 00000.01
|
||||
.byte $fe ; (-1,-0.5) yslope=-0.5 11111.10
|
||||
.byte $fc ; (-1,-1) yslope=-1 11111.00
|
||||
.byte $f0 ; (-1,-4) yslope=-4 11100.00
|
||||
.byte $f8 ; ( 1,-2) yslope=-2 11110.00
|
||||
|
||||
line_colors:
|
||||
.byte $77,$77,$11,$11,$11
|
||||
.byte $77,$77,$77,$11,$77
|
||||
|
||||
|
||||
|
||||
.if 0
|
||||
; 7.1 fixed point
|
||||
|
||||
xslopes:
|
||||
.byte 2 ; (1,0) 0000001.0
|
||||
.byte 1 ; (0.5,2) 0000000.1
|
||||
.byte $ff ; (-0.5,8) 1111111.1
|
||||
.byte $ff ; (-0.5,1) 1111111.1
|
||||
.byte $fe ; (-1,1) 1111111.0
|
||||
.byte $f6 ; (-5,1) 1111011.0 ; 01010 -> 1 011.0
|
||||
.byte $fe ; (-1,-1) 1111111.0
|
||||
.byte $ff ; (-0.5,-1) 1111111.1
|
||||
.byte $ff ; (-0.5,-6) 1111111.1
|
||||
.byte 1 ; ( 0.5,-2) 0000000.1
|
||||
|
||||
; 5.3 fixed point
|
||||
|
||||
yslopes:
|
||||
.byte 0 ; (1,0) 00000.000
|
||||
.byte 2 ; (0.5,2) 00010.000
|
||||
.byte 8 ; (-0.5,8) 00000.001
|
||||
.byte 1 ; (-0.5,1)
|
||||
.byte 1 ; (-1,1)
|
||||
* .byte 1 ; (-5,1)
|
||||
.byte $ff ; (-1,-1)
|
||||
.byte $ff ; (-0.5,-1)
|
||||
.byte $fa ; (-0.5,-6)
|
||||
.byte $fe ; ( 0.5,-2)
|
||||
|
||||
|
||||
.endif
|
17
mist/zp.inc
17
mist/zp.inc
@ -17,6 +17,7 @@ GBASH = $27
|
||||
BASL = $28
|
||||
BASH = $29
|
||||
H2 = $2C
|
||||
X_LEFT = $2C
|
||||
V2 = $2D
|
||||
MASK = $2E
|
||||
COLOR_MASK = $2F
|
||||
@ -60,10 +61,21 @@ RED_PAGES_TAKEN = $80
|
||||
OCTOGON_PAGE = 1
|
||||
MECHE_PAGE = 2
|
||||
SELENA_PAGE = 4
|
||||
STONEY_PAGE = 8
|
||||
CHANNEL_PAGE = 16
|
||||
BLUE_PAGES_TAKEN= $81
|
||||
CLOCK_BRIDGE = $82
|
||||
GEAR_OPEN = $83
|
||||
MARKER_SWITCHES = $84
|
||||
MARKER_DOCK = $01
|
||||
MARKER_GEARS = $02
|
||||
MARKER_SPACESHIP = $04
|
||||
MARKER_GENERATOR = $08
|
||||
MARKER_CLOCK = $10
|
||||
MARKER_TREE = $20
|
||||
MARKER_POOL = $40
|
||||
MARKER_DENTIST = $80
|
||||
|
||||
CLOCK_HOUR = $85
|
||||
CLOCK_MINUTE = $86
|
||||
TREE_FURNACE_ON = $87
|
||||
@ -108,6 +120,11 @@ RED_PAGE_COUNT = $A7
|
||||
BLUE_PAGE_COUNT = $A8
|
||||
VIEWER_CHANNEL = $A9
|
||||
VIEWER_LATCHED = $AA
|
||||
TOWER_ROTATION = $AB
|
||||
ROTATION_GEARS = 2
|
||||
ROTATION_DOCK = 3
|
||||
ROTATION_TREE = 4
|
||||
ROTATION_SPACESHIP = 8
|
||||
|
||||
; done game puzzle state
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user