From a5e9bb4982cf0264564e8cdf332443be12178702 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Fri, 17 Nov 2017 01:11:06 -0500 Subject: [PATCH] tfv: add more world map drawing --- tfv/Makefile | 26 ++--- tfv/tfv_backgrounds.inc | 59 +++++----- tfv/tfv_utils.s | 69 ++++++++++-- tfv/tfv_worldmap.s | 233 +++++++++++++++++++++++++++++++++++++++- tfv/tfv_zp.inc | 4 + 5 files changed, 341 insertions(+), 50 deletions(-) diff --git a/tfv/Makefile b/tfv/Makefile index 3f3fe3a5..57cf5d78 100644 --- a/tfv/Makefile +++ b/tfv/Makefile @@ -28,7 +28,7 @@ duet.o: duet.s -backgrounds.inc: $(PNG2RLE) \ +tfv_backgrounds.inc: $(PNG2RLE) \ title.png map.png \ landing.png harfco.png \ belair.png \ @@ -36,18 +36,18 @@ backgrounds.inc: $(PNG2RLE) \ collegep.png \ umcp.png \ dining.png metro.png talbot.png - $(PNG2RLE) asm title.png title_rle > backgrounds.inc - $(PNG2RLE) asm map.png map_rle >> backgrounds.inc - $(PNG2RLE) asm landing.png landing_rle >> backgrounds.inc - $(PNG2RLE) asm harfco.png harfco_rle >> backgrounds.inc - $(PNG2RLE) asm belair.png belair_rle >> backgrounds.inc - $(PNG2RLE) asm math_office.png math_office_rle >> backgrounds.inc - $(PNG2RLE) asm video_hr.png video_hr_rle >> backgrounds.inc - $(PNG2RLE) asm collegep.png collegep_rle >> backgrounds.inc - $(PNG2RLE) asm umcp.png umcp_rle >> backgrounds.inc - $(PNG2RLE) asm dining.png dining_rle >> backgrounds.inc - $(PNG2RLE) asm metro.png metro_rle >> backgrounds.inc - $(PNG2RLE) asm talbot.png talbot_rle >> backgrounds.inc + $(PNG2RLE) asm title.png title_rle > tfv_backgrounds.inc + $(PNG2RLE) asm map.png map_rle >> tfv_backgrounds.inc + $(PNG2RLE) asm landing.png landing_rle >> tfv_backgrounds.inc + $(PNG2RLE) asm harfco.png harfco_rle >> tfv_backgrounds.inc + $(PNG2RLE) asm belair.png belair_rle >> tfv_backgrounds.inc + $(PNG2RLE) asm math_office.png math_office_rle >> tfv_backgrounds.inc + $(PNG2RLE) asm video_hr.png video_hr_rle >> tfv_backgrounds.inc + $(PNG2RLE) asm collegep.png collegep_rle >> tfv_backgrounds.inc + $(PNG2RLE) asm umcp.png umcp_rle >> tfv_backgrounds.inc + $(PNG2RLE) asm dining.png dining_rle >> tfv_backgrounds.inc + $(PNG2RLE) asm metro.png metro_rle >> tfv_backgrounds.inc + $(PNG2RLE) asm talbot.png talbot_rle >> tfv_backgrounds.inc ### diff --git a/tfv/tfv_backgrounds.inc b/tfv/tfv_backgrounds.inc index 6a8311ba..4a57c984 100644 --- a/tfv/tfv_backgrounds.inc +++ b/tfv/tfv_backgrounds.inc @@ -107,15 +107,16 @@ harfco_rle: .byte $28,$28 .byte $05,$00, $1D,$AA, $01,$77, $09,$00, $01,$F0, $01,$00, $1B,$AA .byte $01,$77, $03,$00, $01,$F0, $03,$00, $01,$F0, $17,$00, $01,$F0 .byte $15,$00, $01,$0F, $19,$00, $01,$F0, $16,$00, $01,$0F, $17,$00 - .byte $28,$22, $27,$77, $01,$22, $27,$77, $01,$22, $27,$77, $01,$22 - .byte $11,$77, $01,$07, $01,$77, $05,$07, $01,$77, $01,$00, $01,$77 - .byte $01,$07, $0B,$77, $01,$22, $0C,$77, $01,$57, $01,$00, $01,$57 - .byte $01,$00, $01,$57, $01,$00, $01,$57, $05,$00, $01,$57, $01,$00 - .byte $01,$57, $01,$00, $01,$57, $0A,$77, $01,$22, $0B,$77, $01,$75 - .byte $01,$55, $01,$50, $03,$55, $01,$50, $09,$55, $01,$50, $01,$55 - .byte $01,$75, $09,$77, $01,$22, $27,$77, $01,$22, $27,$77, $01,$22 - .byte $27,$77, $01,$22, $27,$77, $01,$22, $27,$77, $01,$22, $27,$77 - .byte $01,$22, $27,$77, $01,$22, $27,$77, $01,$22 + .byte $28,$22, $1D,$77, $01,$72, $0A,$22, $1F,$77, $01,$72, $08,$22 + .byte $21,$77, $01,$72, $06,$22, $11,$77, $01,$07, $01,$77, $05,$07 + .byte $01,$77, $01,$00, $01,$77, $01,$07, $07,$77, $05,$22, $0C,$77 + .byte $01,$57, $01,$00, $01,$57, $01,$00, $01,$57, $01,$00, $01,$57 + .byte $05,$00, $01,$57, $01,$00, $01,$57, $01,$00, $01,$57, $07,$77 + .byte $04,$22, $0B,$77, $01,$75, $01,$55, $01,$50, $03,$55, $01,$50 + .byte $09,$55, $01,$50, $01,$55, $01,$75, $07,$77, $03,$22, $25,$77 + .byte $03,$22, $24,$77, $01,$27, $03,$22, $24,$77, $04,$22, $22,$77 + .byte $01,$27, $05,$22, $21,$77, $01,$27, $06,$22, $20,$77, $01,$27 + .byte $07,$22, $1F,$77, $01,$27, $08,$22, $1E,$77, $01,$27, $09,$22 .byte $FF,$FF belair_rle: .byte $28,$28 .byte $0A,$00, $01,$05, $01,$57, $01,$75, $01,$57, $01,$75, $01,$57 @@ -253,16 +254,18 @@ umcp_rle: .byte $28,$28 .byte $07,$46, $1C,$66, $01,$44, $03,$66, $09,$D4, $12,$66, $01,$16 .byte $01,$66, $01,$F6, $01,$66, $01,$16, $03,$66, $03,$44, $02,$66 .byte $01,$DD, $01,$5D, $02,$DD, $01,$5D, $02,$DD, $01,$5D, $01,$DD - .byte $0D,$66, $02,$D6, $03,$66, $01,$51, $01,$56, $01,$5F, $01,$56 - .byte $01,$51, $02,$66, $02,$64, $01,$84, $02,$64, $01,$66, $01,$DD - .byte $01,$D5, $01,$DD, $01,$4D, $01,$44, $01,$4D, $01,$DD, $01,$D5 - .byte $01,$DD, $0B,$66, $02,$6D, $02,$1D, $01,$CC, $01,$5C, $07,$55 - .byte $01,$5C, $02,$CC, $01,$88, $03,$CC, $01,$DD, $01,$5D, $02,$DD - .byte $01,$8D, $02,$DD, $01,$5D, $01,$DD, $06,$CC, $01,$C0, $01,$08 - .byte $01,$58, $01,$50, $01,$0C, $02,$CC, $02,$11, $01,$CC, $01,$1F - .byte $01,$FF, $05,$1F, $01,$FF, $01,$1F, $02,$CC, $01,$88, $03,$CC - .byte $01,$DD, $01,$D5, $02,$DD, $01,$88, $02,$DD, $01,$D5, $01,$DD - .byte $07,$CC, $01,$C0, $01,$08, $01,$58, $01,$50, $01,$05, $01,$55 + .byte $02,$66, $02,$86, $01,$46, $08,$66, $02,$D6, $03,$66, $01,$51 + .byte $01,$56, $01,$5F, $01,$56, $01,$51, $02,$66, $02,$64, $01,$84 + .byte $02,$64, $01,$66, $01,$DD, $01,$D5, $01,$DD, $01,$4D, $01,$44 + .byte $01,$4D, $01,$DD, $01,$D5, $01,$DD, $01,$66, $01,$86, $01,$88 + .byte $01,$84, $02,$44, $05,$66, $02,$6D, $02,$1D, $01,$CC, $01,$5C + .byte $07,$55, $01,$5C, $02,$CC, $01,$88, $03,$CC, $01,$DD, $01,$5D + .byte $02,$DD, $01,$8D, $02,$DD, $01,$5D, $01,$DD, $01,$CC, $01,$C8 + .byte $01,$88, $03,$44, $01,$C0, $01,$08, $01,$58, $01,$50, $01,$0C + .byte $02,$CC, $02,$11, $01,$CC, $01,$1F, $01,$FF, $05,$1F, $01,$FF + .byte $01,$1F, $02,$CC, $01,$88, $03,$CC, $01,$DD, $01,$D5, $02,$DD + .byte $01,$88, $02,$DD, $01,$D5, $01,$DD, $02,$CC, $02,$C8, $01,$C4 + .byte $02,$CC, $01,$C0, $01,$08, $01,$58, $01,$50, $01,$05, $01,$55 .byte $01,$11, $01,$10, $01,$CC, $01,$11, $01,$FF, $01,$10, $01,$11 .byte $01,$10, $01,$11, $01,$10, $01,$FF, $01,$11, $17,$CC, $01,$00 .byte $01,$08, $01,$58, $01,$50, $01,$05, $01,$51, $01,$11, $01,$CC @@ -271,16 +274,14 @@ umcp_rle: .byte $28,$28 .byte $01,$51, $01,$CC, $01,$11, $01,$7F, $02,$71, $01,$78, $02,$71 .byte $01,$7F, $01,$11, $19,$CC, $01,$00, $02,$88, $01,$00, $01,$05 .byte $01,$CC, $09,$C7, $09,$CC, $03,$5C, $0D,$CC, $01,$C0, $01,$05 - .byte $02,$85, $01,$00, $01,$CC, $01,$88, $01,$48, $01,$44, $01,$4C - .byte $0C,$CC, $01,$5C, $01,$E5, $03,$EE, $01,$E5, $01,$5C, $0C,$CC - .byte $01,$00, $02,$58, $01,$50, $02,$88, $01,$48, $02,$44, $0B,$CC - .byte $01,$4C, $01,$FF, $02,$75, $04,$55, $01,$4C, $02,$CC, $01,$DC - .byte $03,$CC, $01,$3C, $04,$CC, $01,$C0, $01,$00, $02,$88, $01,$CC - .byte $01,$88, $01,$84, $01,$44, $01,$C4, $0C,$CC, $01,$C4, $02,$47 - .byte $03,$45, $01,$C4, $02,$CC, $01,$CD, $01,$D9, $01,$CD, $01,$CC - .byte $01,$C3, $01,$3D, $01,$C3, $04,$CC, $01,$00, $01,$05, $01,$85 - .byte $1B,$CC, $01,$C4, $03,$CC, $01,$C4, $06,$CC, $01,$00, $01,$08 - .byte $26,$CC, $01,$C0, $01,$00 + .byte $02,$85, $01,$00, $11,$CC, $01,$5C, $01,$E5, $03,$EE, $01,$E5 + .byte $01,$5C, $0C,$CC, $01,$00, $02,$58, $01,$50, $11,$CC, $01,$FF + .byte $02,$75, $04,$55, $0C,$CC, $01,$C0, $01,$00, $02,$88, $10,$CC + .byte $02,$44, $02,$47, $03,$45, $02,$44, $0C,$CC, $01,$00, $01,$05 + .byte $01,$85, $10,$CC, $01,$44, $01,$D4, $01,$9D, $01,$D4, $01,$44 + .byte $01,$34, $01,$D3, $01,$34, $01,$44, $0D,$CC, $01,$00, $01,$08 + .byte $0F,$CC, $03,$44, $01,$CD, $03,$44, $01,$C3, $03,$44, $0C,$CC + .byte $01,$C0, $01,$00 .byte $FF,$FF dining_rle: .byte $28,$28 .byte $01,$88, $03,$98, $02,$88, $01,$98, $02,$88, $02,$98, $02,$88 diff --git a/tfv/tfv_utils.s b/tfv/tfv_utils.s index 0d55ea41..2d4dc1a1 100644 --- a/tfv/tfv_utils.s +++ b/tfv/tfv_utils.s @@ -525,9 +525,6 @@ hlin_setup: sta GBASH rts - - - ;================================ ; hlin_double: ;================================ @@ -556,17 +553,77 @@ hlin_double: hlin_double_continue: -hlin_loop: +hlin_double_loop: ldy #0 lda COLOR sta (GBASL),Y inc GBASL dex - bne hlin_loop -return: + bne hlin_double_loop + rts + ;================================ + ; hlin_single: + ;================================ + ; HLIN Y, V2 AT A + ; Y, X, A trashed +hlin_single: + + jsr hlin_setup + + sec + lda V2 + sbc TEMPY + + tax + + ; fallthrough + + ;================================= + ; hlin_single_continue: width + ;================================= + ; width in X + +hlin_single_continue: + +hlin_single_top: + lda COLOR + and #$f0 + sta COLOR + +hlin_single_top_loop: + ldy #0 + lda (GBASL),Y + and #$0f + ora COLOR + sta (GBASL),Y + inc GBASL + dex + bne hlin_single_top_loop + + rts + +hlin_single_bottom: + + lda COLOR + and #$0f + sta COLOR + +hlin_single_bottom_loop: + ldy #0 + lda (GBASL),Y + and #$f0 + sta (GBASL),Y + inc GBASL + dex + bne hlin_single_bottom_loop + + rts + + + ;============================= ; clear_top ;============================= diff --git a/tfv/tfv_worldmap.s b/tfv/tfv_worldmap.s index c8bd310c..fe609ae7 100644 --- a/tfv/tfv_worldmap.s +++ b/tfv/tfv_worldmap.s @@ -9,6 +9,7 @@ TFV_Y EQU $82 NEWX EQU $83 NEWY EQU $84 MAP_X EQU $85 +GROUND_COLOR EQU $86 ; In Town @@ -431,9 +432,160 @@ map_sky: ; draw line across screen cmp #10 bne map_sky -map_grassland: + ;================= + ; Set Ground Color + ;================= - lda #COLOR_BOTH_LIGHTGREEN ; LIGHTGREEN color + ldx #COLOR_BOTH_LIGHTGREEN ; grass color + + lda MAP_X + cmp #4 + bpl not_artic + ldx #COLOR_BOTH_WHITE ; snow color +not_artic: + cmp #13 + bne not_desert + ldx #COLOR_BOTH_ORANGE +not_desert: + stx GROUND_COLOR + + + ;============================= + ; sloped left beach + ;============================= + + lda #3 + and MAP_X + bne not_sloped_left + + lda #10 +sloped_left_loop: + pha + eor #$ff ; temp=4+(40-i)/8; + sec + adc #40 + 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 + adc #36 + tax + + jsr hlin_double_continue + + pla + clc + adc #2 + cmp #40 + bne sloped_left_loop + + beq done_base + +not_sloped_left: + + ;============================= + ; sloped right beach + ;============================= + + 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 + adc #36 + 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 @@ -450,6 +602,83 @@ grassland_loop: ; draw line across screen cmp #40 bne grassland_loop +done_base: + + ;============================== + ; Draw North Shore + ;============================== +draw_north_shore: + lda MAP_X + cmp #4 + bpl draw_south_shore + + ldx #COLOR_BOTH_DARKBLUE + stx COLOR + + lda #40 + sta V2 + ldy #0 + lda #10 + + jsr hlin_double + + + ;============================== + ; Draw South Shore + ;============================== +draw_south_shore: + lda MAP_X + cmp #12 + bmi draw_mountains + + ;=============================== + ; Draw Mountains + ;=============================== +draw_mountains: + lda MAP_X + and #3 + cmp #2 + bne done_drawing + + lda #0 +mountain_loop: + pha + + lda #>mountain + sta INH + lda #