dos33fsprogs/games/tfv/tfv_overworld.s

1181 lines
16 KiB
ArmAsm
Raw Normal View History

2017-09-13 02:39:50 +00:00
; In Town
; Puzzle Room
; Get through office
; Have to run away? What happens if die? No save game? Code?
; Construct the LED circuit
; Zaps through cloud
; Susie joins your party
; Final Battle
; Play music, lightning effects?
; TFV only hit for one damage, susie for 100
2020-12-31 20:01:44 +00:00
handle_overworld:
2017-09-13 01:56:11 +00:00
2017-09-13 02:39:50 +00:00
;===================
; Clear screen/pages
;===================
jsr clear_screens
2020-12-30 06:41:14 +00:00
bit PAGE0
lda #0
sta DISP_PAGE
lda #4
sta DRAW_PAGE
2017-09-13 02:39:50 +00:00
;===============
; Init Variables
;===============
lda #HERO_DIRECTION ; have us face right (1)
sta HERO_STATE
2017-09-13 02:39:50 +00:00
lda #$1
sta REFRESH
2021-01-19 17:20:53 +00:00
lda #3
sta HERO_LIMIT
2017-11-16 21:08:46 +00:00
lda #5
sta MAP_X
2017-11-16 20:37:22 +00:00
lda #15
sta TFV_X
lda #20
sta TFV_Y
;==================
; MAIN LOOP
;==================
2017-09-13 02:39:50 +00:00
worldmap_loop:
2017-11-16 20:37:22 +00:00
lda #$0
sta HERO_MOVED
2017-11-16 20:37:22 +00:00
lda TFV_X
sta NEWX
lda TFV_Y
sta NEWY
2017-09-13 02:39:50 +00:00
worldmap_keyboard:
2020-12-30 06:41:14 +00:00
jsr get_keypress ; get keypress
2017-09-13 02:39:50 +00:00
2017-11-16 20:37:22 +00:00
worldmap_handle_q:
2021-01-05 20:32:11 +00:00
cmp #'Q' ; if quit, then return
2017-11-16 20:37:22 +00:00
bne worldmap_handle_up
2017-09-13 02:39:50 +00:00
rts
2017-11-16 20:37:22 +00:00
worldmap_handle_up:
2021-01-05 20:32:11 +00:00
cmp #'W'
2017-11-16 20:37:22 +00:00
bne worldmap_handle_down
dec NEWY
dec NEWY
inc HERO_MOVED
2021-01-05 20:32:11 +00:00
jmp worldmap_done_keyboard
2017-11-16 20:37:22 +00:00
worldmap_handle_down:
2021-01-05 20:32:11 +00:00
cmp #'S'
2017-11-16 20:37:22 +00:00
bne worldmap_handle_left
inc NEWY
inc NEWY
inc HERO_MOVED
2021-01-05 20:32:11 +00:00
jmp worldmap_done_keyboard
2017-11-16 20:37:22 +00:00
worldmap_handle_left:
2021-01-05 20:32:11 +00:00
cmp #'A'
2017-11-16 20:37:22 +00:00
bne worldmap_handle_right
lda HERO_STATE
and #HERO_DIRECTION ; 0=left, 1=right
2017-11-16 21:08:46 +00:00
beq go_left ; if (0) already left, keep going
left_turn:
lda HERO_STATE
and #<(~HERO_DIRECTION) ; change direction to left (0)
and #<(~HERO_ODD) ; stand (not walk) if changing
sta HERO_STATE
jmp done_handle_left ; skip ahead
2017-11-16 21:08:46 +00:00
go_left:
dec NEWX ; decrement x
inc HERO_MOVED ; we moved
2021-01-05 20:32:11 +00:00
done_handle_left:
jmp worldmap_done_keyboard
2017-11-16 20:37:22 +00:00
worldmap_handle_right:
cmp #('D')
bne worldmap_handle_enter
lda HERO_STATE
and #HERO_DIRECTION ; 0=left, 1=right
2017-11-16 21:08:46 +00:00
bne go_right ; if (1) already right, keep going
right_turn:
lda HERO_STATE
ora #HERO_DIRECTION ; change direction to right (1)
and #<(~HERO_ODD) ; change to standing
sta HERO_STATE
jmp done_handle_right ; skip ahead
2017-11-16 21:08:46 +00:00
go_right:
inc NEWX ; increment X
inc HERO_MOVED
2017-11-16 21:08:46 +00:00
2021-01-05 20:32:11 +00:00
done_handle_right:
jmp worldmap_done_keyboard
2017-11-16 20:37:22 +00:00
worldmap_handle_enter:
cmp #13
bne worldmap_handle_help
; jsr city_map
inc REFRESH
2021-01-05 20:32:11 +00:00
jmp worldmap_done_keyboard
2017-11-16 20:37:22 +00:00
worldmap_handle_help:
cmp #('H')
bne worldmap_handle_battle
2017-11-18 20:17:28 +00:00
jsr print_help
2021-01-05 20:32:11 +00:00
jmp worldmap_done_keyboard
2017-11-16 20:37:22 +00:00
worldmap_handle_battle:
2021-01-05 20:32:11 +00:00
cmp #'B'
2017-11-16 20:37:22 +00:00
bne worldmap_handle_info
2021-01-05 20:32:11 +00:00
jsr do_battle
2017-11-16 20:37:22 +00:00
inc REFRESH
2021-01-05 20:32:11 +00:00
jmp worldmap_done_keyboard
2017-11-16 20:37:22 +00:00
worldmap_handle_info:
2021-01-05 20:32:11 +00:00
cmp #'I'
2017-11-16 20:37:22 +00:00
bne worldmap_handle_map
2021-02-10 18:16:52 +00:00
jsr print_info
2017-11-16 20:37:22 +00:00
inc REFRESH
2021-01-05 20:32:11 +00:00
jmp worldmap_done_keyboard
2017-11-16 20:37:22 +00:00
worldmap_handle_map:
cmp #('M')
bne worldmap_done_keyboard
2021-01-05 20:32:11 +00:00
jsr show_map
2017-11-16 20:37:22 +00:00
inc REFRESH
2021-01-05 20:32:11 +00:00
; jmp worldmap_done_keyboard
2017-11-16 20:37:22 +00:00
worldmap_done_keyboard:
;===========================
; Handle Movement
;===========================
lda HERO_MOVED
2017-11-16 21:08:46 +00:00
beq worldmap_refresh_screen
lda HERO_STATE ; toggle ODD
eor #HERO_ODD
sta HERO_STATE
inc HERO_STEPS
2017-11-16 20:37:22 +00:00
; Handle Collision Detection
2017-11-16 21:08:46 +00:00
lda NEWX
sta TFV_X
lda NEWY
sta TFV_Y
check_high_x:
lda TFV_X
cmp #36
bmi check_low_x
; Off screen to right
lda #0
sta TFV_X
inc MAP_X
inc REFRESH
bne check_high_y
check_low_x:
lda TFV_X
bpl check_high_y
2017-11-16 21:08:46 +00:00
dec MAP_X
lda #35
sta TFV_X
inc REFRESH
2017-09-13 02:39:50 +00:00
2017-11-16 21:08:46 +00:00
check_high_y:
lda TFV_Y ; load Y value
cmp #28
bmi check_low_y ; if less than 28, check low Y
clc
lda #$4
sta TFV_Y
adc MAP_X
sta MAP_X
inc REFRESH
bne done_map_check
2017-11-16 21:08:46 +00:00
check_low_y:
lda TFV_Y
cmp #4
bpl done_map_check
lda #28
sta TFV_Y
dec MAP_X
dec MAP_X
dec MAP_X
dec MAP_X
inc REFRESH
done_map_check:
2017-11-16 21:08:46 +00:00
2017-11-16 20:37:22 +00:00
;============================
; Refresh screen if needed
;============================
worldmap_refresh_screen:
2017-09-13 02:39:50 +00:00
lda REFRESH
beq worldmap_copy_background
jsr load_map_bg
dec REFRESH
worldmap_copy_background:
2017-11-19 02:18:01 +00:00
;================
2017-11-16 20:37:22 +00:00
; Copy background
2017-11-19 02:18:01 +00:00
;================
2017-11-16 20:37:22 +00:00
2020-12-31 20:01:44 +00:00
jsr gr_copy_to_current_40x40
2017-11-16 20:37:22 +00:00
2017-11-19 02:18:01 +00:00
;=================================
; Handle background ground scatter
;=================================
2017-11-16 20:37:22 +00:00
2017-11-19 02:18:01 +00:00
; if (map_x==1) if (tfv_y>=22) grsim_put_sprite(snowy_tree,10,20);
2017-11-16 20:37:22 +00:00
2017-11-19 02:18:01 +00:00
lda MAP_X
cmp #1
bne back_not_snow
lda TFV_Y
cmp #22
bmi no_back_scatter
; snowy tree
lda #>snowy_tree
sta INH
lda #<snowy_tree
sta INL
lda #10
sta XPOS
lda #20
sta YPOS
bne back_scatter_sprite
back_not_snow:
; if (map_x==4) if (tfv_y>=16) grsim_put_sprite(pine_tree,25,16);
cmp #4
bne back_not_pine
lda TFV_Y
cmp #16
bmi no_back_scatter
; pine tree
lda #>pine_tree
sta INH
lda #<pine_tree
sta INL
lda #25
sta XPOS
lda #16
sta YPOS
bne back_scatter_sprite
back_not_pine:
; palm tree
; if (map_x==8) if (tfv_y>=22) grsim_put_sprite(palm_tree,10,20);
cmp #8
bne back_not_palm
lda #10
sta XPOS
2017-11-16 20:37:22 +00:00
2017-11-19 02:18:01 +00:00
bne back_palm
back_not_palm:
; palm tree 2
; if (map_x==12) if (tfv_y>=22) grsim_put_sprite(palm_tree,20,20);
cmp #12
bne back_not_palm2
lda #20
sta XPOS
back_palm:
lda TFV_Y
cmp #22
bmi no_back_scatter
lda #>palm_tree
sta INH
lda #<palm_tree
sta INL
lda #20
sta YPOS
bne back_scatter_sprite
back_not_palm2:
cmp #13
bne no_back_scatter
lda TFV_Y
cmp #16
bmi no_back_scatter
; cactus
; if (map_x==13) if (tfv_y>=16) grsim_put_sprite(cactus,25,16);
lda #>cactus
sta INH
lda #<cactus
sta INL
lda #25
sta XPOS
lda #16
sta YPOS
back_scatter_sprite:
jsr put_sprite_crop
2017-11-19 02:18:01 +00:00
no_back_scatter:
2017-11-19 03:52:25 +00:00
;========================
2017-11-19 02:18:01 +00:00
; Draw background forest
2017-11-19 03:52:25 +00:00
;========================
lda MAP_X ; if ((map_x==7) || (map_x==11))
cmp #7
beq back_forest
cmp #11
bne back_no_forest
back_forest:
lda #COLOR_BOTH_DARKGREEN
sta COLOR
lda TFV_Y
clc
adc #6
2017-11-19 03:52:25 +00:00
back_forest_loop:
pha ; 10, ends at 23
lsr ; limit=22+(i/4);
lsr
clc
adc #22
sta V2
ldy #0
pla
pha
jsr hlin_double ; hlin y,V2 at A
; for(i=10;i<tfv_y+8;i+=2)
2017-11-19 02:18:01 +00:00
; hlin_double(ram[DRAW_PAGE],0,limit,i);
2017-11-19 03:52:25 +00:00
pla
clc
adc #$fe ; -2
cmp #8
bne back_forest_loop
back_no_forest:
2017-11-19 02:18:01 +00:00
;=============
; Draw TFV
;=============
2017-11-16 21:08:46 +00:00
clc
; check if standing
lda HERO_STATE
and #HERO_ODD
2017-11-16 20:37:22 +00:00
bne standing
walking:
lda HERO_STATE
and #HERO_DIRECTION ; 0=left, 1=right
2017-11-16 21:08:46 +00:00
bne walking_right ; if(!0) walk right
2017-11-16 20:37:22 +00:00
walking_left:
2021-01-11 20:20:43 +00:00
lda #>tfv_walk_left_sprite
2017-11-16 20:37:22 +00:00
sta INH
2021-01-11 20:20:43 +00:00
lda #<tfv_walk_left_sprite
2017-11-16 20:37:22 +00:00
sta INL
2017-11-16 21:08:46 +00:00
bcc done_walking
2017-11-16 20:37:22 +00:00
walking_right:
2021-01-11 20:20:43 +00:00
lda #>tfv_walk_right_sprite
2017-11-16 20:37:22 +00:00
sta INH
2021-01-11 20:20:43 +00:00
lda #<tfv_walk_right_sprite
2017-11-16 20:37:22 +00:00
sta INL
2017-11-16 21:08:46 +00:00
bcc done_walking
2017-11-16 20:37:22 +00:00
standing:
lda HERO_STATE
and #HERO_DIRECTION
2017-11-16 20:37:22 +00:00
bne standing_right
standing_left:
2021-01-11 20:20:43 +00:00
lda #>tfv_stand_left_sprite
2017-11-16 20:37:22 +00:00
sta INH
2021-01-11 20:20:43 +00:00
lda #<tfv_stand_left_sprite
2017-11-16 20:37:22 +00:00
sta INL
2017-11-16 21:08:46 +00:00
bcc done_walking
2017-11-16 20:37:22 +00:00
standing_right:
2021-01-11 20:20:43 +00:00
lda #>tfv_stand_right_sprite
2017-11-16 20:37:22 +00:00
sta INH
2021-01-11 20:20:43 +00:00
lda #<tfv_stand_right_sprite
2017-11-16 20:37:22 +00:00
sta INL
done_walking:
lda TFV_X
sta XPOS
lda TFV_Y
sta YPOS
jsr put_sprite_crop
2017-11-16 20:37:22 +00:00
; if (direction==-1) {
; if (odd) grsim_put_sprite(tfv_walk_left,tfv_x,tfv_y);
; else grsim_put_sprite(tfv_stand_left,tfv_x,tfv_y);
; }
; if (direction==1) {
; if (odd) grsim_put_sprite(tfv_walk_right,tfv_x,tfv_y);
; else grsim_put_sprite(tfv_stand_right,tfv_x,tfv_y);
; }
2017-11-19 02:18:01 +00:00
;=================================
; Handle foreground ground scatter
;=================================
;if (map_x==1) if (tfv_y<22) grsim_put_sprite(snowy_tree,10,22);
lda MAP_X
cmp #1
bne fore_not_snow
lda TFV_Y
cmp #22
bpl no_fore_scatter
; snowy tree
lda #>snowy_tree
sta INH
lda #<snowy_tree
sta INL
lda #10
sta XPOS
lda #20
sta YPOS
bne fore_scatter_sprite
fore_not_snow:
; if (map_x==4) if (tfv_y<15) grsim_put_sprite(pine_tree,25,15);
cmp #4
bne fore_not_pine
lda TFV_Y
cmp #16
bpl no_fore_scatter
; pine tree
lda #>pine_tree
sta INH
lda #<pine_tree
sta INL
lda #25
sta XPOS
lda #16
sta YPOS
bne fore_scatter_sprite
fore_not_pine:
; palm tree
; if (map_x==8) if (tfv_y<22) grsim_put_sprite(palm_tree,10,20);
cmp #8
bne fore_not_palm
lda #10
sta XPOS
bne fore_palm
fore_not_palm:
; palm tree 2
; if (map_x==12) if (tfv_y<22) grsim_put_sprite(palm_tree,20,20);
cmp #12
bne fore_not_palm2
lda #20
sta XPOS
fore_palm:
lda TFV_Y
cmp #22
bpl no_fore_scatter
lda #>palm_tree
sta INH
lda #<palm_tree
sta INL
lda #20
sta YPOS
bne fore_scatter_sprite
fore_not_palm2:
cmp #13
bne no_fore_scatter
lda TFV_Y
cmp #16
bpl no_fore_scatter
; cactus
; if (map_x==13) if (tfv_y<15) grsim_put_sprite(cactus,25,15);
lda #>cactus
sta INH
lda #<cactus
sta INL
lda #25
sta XPOS
lda #16
sta YPOS
fore_scatter_sprite:
jsr put_sprite_crop
2017-11-16 20:37:22 +00:00
2017-11-19 02:18:01 +00:00
no_fore_scatter:
2017-11-19 03:52:25 +00:00
;========================
; Draw foreground forest
;========================
2017-11-19 02:18:01 +00:00
2017-11-19 03:52:25 +00:00
lda MAP_X ; if ((map_x==7) || (map_x==11))
cmp #7
beq fore_forest
cmp #11
bne fore_no_forest
2017-11-19 02:18:01 +00:00
2017-11-19 03:52:25 +00:00
fore_forest:
lda #COLOR_BOTH_DARKGREEN
sta COLOR
2017-11-19 02:18:01 +00:00
2017-11-19 03:52:25 +00:00
lda TFV_Y
clc
adc #8
fore_forest_loop:
cmp #36
beq done_forest_loop
2017-11-19 03:52:25 +00:00
pha
lsr ; limit=22+(i/4);
lsr
clc
adc #22
sta V2
ldy #0
pla
pha
jsr hlin_double ; hlin y,V2 at A
2017-11-19 02:18:01 +00:00
; for(i=tfv_y+8;i<36;i+=2) {
; hlin_double(ram[DRAW_PAGE],0,limit,i);
2017-11-19 03:52:25 +00:00
pla
clc
adc #2
bne fore_forest_loop
done_forest_loop:
2017-11-19 03:52:25 +00:00
;====================
; Draw tree trunks
;====================
lda #36
outer_treetrunk_loop:
pha
lda #COLOR_BOTH_BROWN
sta COLOR
lda #0 ; hlin_double(ram[DRAW_PAGE],0,0,36);
sta V2
ldy #0
pla
pha
jsr hlin_double ; hlin y,V2 at A
lda #0
treetrunk_loop:
pha
lda #COLOR_BOTH_GREY
sta COLOR
ldx #1
jsr hlin_double_continue
lda #COLOR_BOTH_BROWN
sta COLOR
ldx #1
jsr hlin_double_continue
pla
clc
adc #1
cmp #13
bne treetrunk_loop
pla
clc
adc #2
cmp #40
bne outer_treetrunk_loop
2017-11-19 02:18:01 +00:00
; color_equals(COLOR_BROWN);
; hlin_double(ram[DRAW_PAGE],0,1,37);
; for(i=0;i<13;i++) {
; color_equals(COLOR_GREY);
; hlin_double_continue(1);
; color_equals(COLOR_BROWN);
; hlin_double_continue(1);
; }
; }
2017-11-19 03:52:25 +00:00
fore_no_forest:
2017-11-19 04:17:41 +00:00
;=============================
2017-11-19 02:18:01 +00:00
; Draw lightning
2017-11-19 04:17:41 +00:00
;=============================
lda MAP_X
cmp #3
bne no_lightning
lda HERO_STEPS
2017-11-19 04:17:41 +00:00
and #$f
bne no_lightning
lda #>lightning
sta INH
lda #<lightning
sta INL
lda #25
sta XPOS
lda #4
sta YPOS
jsr put_sprite_crop ; grsim_put_sprite(lightning,25,4);
2017-11-19 04:17:41 +00:00
;=============================
; Hurt hit points if in range?
;=============================
2017-11-19 02:18:01 +00:00
; if ((tfv_x>25) && (tfv_x<30) && (tfv_y<12)) {
; printf("HIT! %d %d\n\n",steps,hp);
; if (hp>11) {
; hp=10;
2017-11-16 20:37:22 +00:00
2017-11-19 04:17:41 +00:00
no_lightning:
2017-11-16 20:37:22 +00:00
2017-09-13 02:39:50 +00:00
jsr page_flip
2017-11-16 20:37:22 +00:00
;============
; Update Time
;============
; if (steps>=60) {
; steps=0;
; time_minutes++;
; if (time_minutes>=60) {
; time_hours++;
; time_minutes=0;
; }
; }
2017-09-13 02:39:50 +00:00
jmp worldmap_loop
; Map
;
; 0 1 2 3
;
; 0 BEACH ARCTIC ARCTIC BELAIR
; TREE MOUNATIN
;
; 1 BEACH LANDING GRASS FOREST
; PINETREE MOUNTAIN
;
; 2 BEACH GRASS GRASS FOREST
; PALMTREE MOUNTAIN
;
; 3 BEACH DESERT COLLEGE BEACH
; CACTUS PARK
;=============================================
;=============================================
; Load World Map background
;=============================================
;=============================================
2017-11-16 20:37:22 +00:00
2017-09-13 02:39:50 +00:00
load_map_bg:
2017-11-19 03:52:25 +00:00
; Set target for the background drawing
; Check for special cases
lda MAP_X
map_harfco:
2017-11-19 03:52:25 +00:00
cmp #3 ; if map_x==3, harfco
bne map_landing
lda #<(harfco_lzsa)
sta getsrc_smc+1
lda #>(harfco_lzsa)
sta getsrc_smc+2
lda #$c
jsr decompress_lzsa2_fast
rts
map_landing:
2017-11-19 03:52:25 +00:00
cmp #5 ; if map_x==5, landing site
bne map_collegep
lda #<(landing_lzsa)
sta getsrc_smc+1
lda #>(landing_lzsa)
sta getsrc_smc+2
lda #$c
jsr decompress_lzsa2_fast
rts
map_collegep:
2017-11-19 03:52:25 +00:00
cmp #14 ; if map_x==14, collegep
bne map_custom
lda #<(collegep_lzsa)
sta getsrc_smc+1
lda #>(collegep_lzsa)
sta getsrc_smc+2
lda #$c
jsr decompress_lzsa2_fast
rts
2017-11-19 03:52:25 +00:00
;============================
; draw parametric background
;============================
map_custom:
; Draw the Sky
2017-11-19 03:52:25 +00:00
lda DRAW_PAGE ; save the DRAW_PAGE value for later
pha
2017-11-19 03:52:25 +00:00
lda #$8 ; temporarily draw to 0xc00
sta DRAW_PAGE
lda #COLOR_BOTH_MEDIUMBLUE ; MEDIUMBLUE color
sta COLOR
lda #0
map_sky: ; draw line across screen
2017-11-19 03:52:25 +00:00
ldy #39 ; from y=0 to y=10
sty V2
ldy #0
pha
jsr hlin_double ; hlin y,V2 at A
pla
clc
adc #2
cmp #10
bne map_sky
2017-11-17 06:11:06 +00:00
;=================
; Set Ground Color
;=================
2017-11-19 03:52:25 +00:00
ldx #COLOR_BOTH_LIGHTGREEN ; default is grass color
2017-11-17 06:11:06 +00:00
lda MAP_X
cmp #4
bpl not_artic
2017-11-19 03:52:25 +00:00
ldx #COLOR_BOTH_WHITE ; snow white
2017-11-17 06:11:06 +00:00
not_artic:
cmp #13
bne not_desert
2017-11-19 03:52:25 +00:00
ldx #COLOR_BOTH_ORANGE ; desert orange
2017-11-17 06:11:06 +00:00
not_desert:
stx GROUND_COLOR
2017-11-19 03:52:25 +00:00
;===========================================
; sloped left beach, of left side of island
;===========================================
2017-11-17 06:11:06 +00:00
lda #3
and MAP_X
bne not_sloped_left
lda #10
sloped_left_loop:
pha
2017-11-19 03:52:25 +00:00
eor #$ff ; temp=4+(39-i)/8;
2017-11-17 06:11:06 +00:00
sec
2017-11-19 03:52:25 +00:00
adc #39
2017-11-17 06:11:06 +00:00
lsr
lsr
lsr
sec
adc #3
sta TEMP
sta V2
pla
pha
ldx #COLOR_BOTH_DARKBLUE
stx COLOR
ldy #0
jsr hlin_double
ldx #COLOR_BOTH_LIGHTBLUE
stx COLOR
ldx #2
jsr hlin_double_continue
ldx #COLOR_BOTH_YELLOW
stx COLOR
ldx #2
jsr hlin_double_continue
ldx GROUND_COLOR
stx COLOR
lda TEMP
eor #$ff
sec
2017-11-19 03:52:25 +00:00
adc #35
2017-11-17 06:11:06 +00:00
tax
jsr hlin_double_continue
pla
clc
adc #2
cmp #40
bne sloped_left_loop
beq done_base
not_sloped_left:
2017-11-19 03:52:25 +00:00
;=============================================
; sloped right beach, on right side of island
;=============================================
2017-11-17 06:11:06 +00:00
lda #3
and MAP_X
cmp #3
bne not_sloped_right
lda #10
sloped_right_loop:
pha
lsr ; temp=24+(A/4)
lsr ; A/4
clc
adc #24
sta TEMP
sta V2
pla
pha
ldx GROUND_COLOR
stx COLOR
ldy #0
jsr hlin_double
ldx #COLOR_BOTH_YELLOW
stx COLOR
ldx #2
jsr hlin_double_continue
ldx #COLOR_BOTH_LIGHTBLUE
stx COLOR
ldx #2
jsr hlin_double_continue
ldx #COLOR_BOTH_DARKBLUE
stx COLOR
lda TEMP
eor #$ff
sec
2017-11-19 03:52:25 +00:00
adc #35
2017-11-17 06:11:06 +00:00
tax
jsr hlin_double_continue
; color_equals(ground_color);
; hlin(PAGE2,0,temp,i);
; color_equals(COLOR_YELLOW);
; hlin_continue(2);
; color_equals(COLOR_LIGHTBLUE);
; hlin_continue(2);
; color_equals(COLOR_DARKBLUE);
; hlin_continue(36-temp);
pla
clc
adc #$2
cmp #40
bne sloped_right_loop
beq done_base
;==============================
; grassland
;==============================
not_sloped_right:
lda GROUND_COLOR
sta COLOR
lda #10
grassland_loop: ; draw line across screen
ldy #40 ; from y=0 to y=10
sty V2
ldy #0
pha
jsr hlin_double ; hlin y,V2 at A
pla
clc
adc #2
cmp #40
bne grassland_loop
2017-09-13 02:39:50 +00:00
2017-11-17 06:11:06 +00:00
done_base:
;==============================
; Draw North Shore
;==============================
draw_north_shore:
lda MAP_X
cmp #4
bpl draw_south_shore
ldx #COLOR_BOTH_DARKBLUE
stx COLOR
lda #39
2017-11-17 06:11:06 +00:00
sta V2
ldy #0
lda #10
jsr hlin_double
;==============================
; Draw South Shore
;==============================
draw_south_shore:
lda MAP_X
cmp #12
bmi draw_mountains
2017-11-18 21:27:42 +00:00
ldx #COLOR_BOTH_DARKBLUE
stx COLOR
2017-11-19 03:52:25 +00:00
lda #39
2017-11-18 21:27:42 +00:00
sta V2
ldy #0
lda #38
jsr hlin_double ; hlin 0,39 at 38
ldx #COLOR_BOTH_LIGHTBLUE
stx COLOR
2017-11-19 03:52:25 +00:00
lda #39
2017-11-18 21:27:42 +00:00
sta V2
lda #15
cmp MAP_X
bne lblue_15
lda #35
sta V2
lblue_15:
ldy #0
lda #12
cmp MAP_X
bne lblue_12
ldy #6
lblue_12:
lda #36
jsr hlin_double ; hlin 0,39 at 36
ldx #COLOR_BOTH_YELLOW
stx COLOR
2017-11-19 03:52:25 +00:00
lda #39
2017-11-18 21:27:42 +00:00
sta V2
lda #15
cmp MAP_X
bne yellow_15
lda #32
sta V2
yellow_15:
ldy #0
lda #12
cmp MAP_X
bne yellow_12
ldy #8
yellow_12:
lda #34
jsr hlin_double ; hlin 0,39 at 34
2017-11-17 06:11:06 +00:00
;===============================
; Draw Mountains
;===============================
draw_mountains:
lda MAP_X
and #3
cmp #2
bne done_drawing
lda #0
mountain_loop:
pha
lda #>mountain
sta INH
lda #<mountain
sta INL
pla
pha
and #1
sta XPOS
asl
asl
clc
adc #10
adc XPOS
sta XPOS
pla
pha
asl
asl
asl
clc
adc #2
sta YPOS
jsr put_sprite_crop
2017-11-17 06:11:06 +00:00
pla
clc
adc #1
cmp #4
bne mountain_loop
done_drawing:
pla ; restore the draw page
sta DRAW_PAGE
2017-09-13 02:39:50 +00:00
rts