junglejourney

changeset 100:0a3cdf90a812

Hopefully fixed the routine to add strength and update the strength bar.
author David Boddie <david@boddie.org.uk>
date Sat Sep 03 14:58:53 2011 +0200
parents 68552fbfded8
children 5be3200c0d82
files mapcode.oph
diffstat 1 files changed, 70 insertions(+), 23 deletions(-) [+]
line diff
     1.1 --- a/mapcode.oph	Sat Sep 03 01:29:27 2011 +0200
     1.2 +++ b/mapcode.oph	Sat Sep 03 14:58:53 2011 +0200
     1.3 @@ -3651,7 +3651,7 @@
     1.4      clc
     1.5      rts
     1.6  
     1.7 -strength_units: .byte $00,$88,$cc,$ee
     1.8 +strength_units:          .byte $00,$88,$cc,$ee
     1.9  
    1.10  add_strength:   ; $70=strength to add
    1.11  
    1.12 @@ -3660,6 +3660,7 @@
    1.13      ; is to mask off the bottom two bits and shift left once.
    1.14      lda $3df4
    1.15      and #$fc
    1.16 +    sta $71     ; strength rounded down to a multiple of four units
    1.17      asl
    1.18      clc
    1.19      tay
    1.20 @@ -3670,30 +3671,30 @@
    1.21      bmi add_strength_update
    1.22  
    1.23      lda #64
    1.24 -    sec
    1.25 -    sbc $3df4
    1.26 -    sta $70
    1.27 -    lda #64
    1.28  
    1.29      add_strength_update:
    1.30      clc
    1.31 -    sta $3df4
    1.32 -
    1.33 -    ldx $70
    1.34 +    sta $3df4   ; the final strength
    1.35 +
    1.36 +    sec
    1.37 +    sbc $71
    1.38 +    clc
    1.39 +    tax         ; the number of units to add between the rounded original
    1.40 +                ; strength and the final strength
    1.41  
    1.42      lda #$f3    ; the start of the strength bar
    1.43 -    sta $70
    1.44 +    sta $72
    1.45      lda #$59
    1.46 -    sta $71
    1.47 +    sta $73
    1.48 +
    1.49 +    cpx #4
    1.50 +    bmi add_strength_loop_extra
    1.51  
    1.52      add_strength_loop:
    1.53  
    1.54 -        cpx #4
    1.55 -        bmi add_strength_loop_extra
    1.56 -
    1.57          clc
    1.58          lda #$ff
    1.59 -        sta ($70),y
    1.60 +        sta ($72),y
    1.61  
    1.62          tya
    1.63          adc #8
    1.64 @@ -3709,13 +3710,19 @@
    1.65          bpl add_strength_loop
    1.66  
    1.67      add_strength_loop_extra:
    1.68 +    cpx #0
    1.69 +    beq add_strength_exit
    1.70  
    1.71      ; For any remaining units in excess of the multiples of four units, plot
    1.72      ; the appropriate byte.
    1.73 +    lda $3df4
    1.74 +    and #3
    1.75 +    tax
    1.76  
    1.77      lda strength_units,x
    1.78      sta ($70),y
    1.79  
    1.80 +    add_strength_exit:
    1.81      clc
    1.82      rts
    1.83  
    1.84 @@ -4115,7 +4122,10 @@
    1.85  
    1.86      rts
    1.87  
    1.88 -title_vdu_bytes: .byte 12, 17,2, 31,4,27, "Press SPACE", 31,7,28, "to play"
    1.89 +title_vdu_bytes:    .byte 12, 17,2, 31,4,27, "Press SPACE", 31,7,28, "to play"
    1.90 +title_vdu_bytes1:   .byte 17,3, 31,1,30, "     (c) 2011     "
    1.91 +title_vdu_bytes2:   .byte 17,3, 31,1,30, "   David Boddie"
    1.92 +title_vdu_bytes3:   .byte 17,1, 31,1,30, "for Retro Software"
    1.93  
    1.94  show_title:
    1.95  
    1.96 @@ -4139,6 +4149,51 @@
    1.97          cpx #27
    1.98          bmi write_title_text_loop
    1.99  
   1.100 +    lda #0
   1.101 +    sta $72
   1.102 +
   1.103 +    show_title_wait_loop:
   1.104 +
   1.105 +        lda #150
   1.106 +        sta $3df5
   1.107 +
   1.108 +        lda $72
   1.109 +        tax
   1.110 +        ldy #22
   1.111 +        show_title_wait_message_loop:
   1.112 +
   1.113 +            lda title_vdu_bytes1, x
   1.114 +            jsr $ffee
   1.115 +            inx
   1.116 +            dey
   1.117 +            bpl show_title_wait_message_loop
   1.118 +
   1.119 +        cpx #69
   1.120 +        beq show_title_wait_reset_offset
   1.121 +
   1.122 +        txa
   1.123 +        sta $72
   1.124 +        jmp show_title_wait_inner_loop
   1.125 +
   1.126 +        show_title_wait_reset_offset:
   1.127 +        lda #0
   1.128 +        sta $72
   1.129 +
   1.130 +        show_title_wait_inner_loop:
   1.131 +        lda #19
   1.132 +        jsr $fff4
   1.133 +
   1.134 +        dec $3df5
   1.135 +        beq show_title_wait_loop
   1.136 +
   1.137 +        show_title_wait_loop_no_update:
   1.138 +        lda #129
   1.139 +        ldx #157
   1.140 +        ldy #255
   1.141 +        jsr $fff4
   1.142 +        cpy #255
   1.143 +        bne show_title_wait_inner_loop
   1.144 +
   1.145      rts
   1.146  
   1.147  game_over_vdu_bytes: .byte 31,4,14, 17,2, "The journey", 31,6,15, "is over"
   1.148 @@ -4335,14 +4390,6 @@
   1.149  
   1.150          jsr show_title
   1.151  
   1.152 -        main_wait_loop:
   1.153 -            lda #129
   1.154 -            ldx #157
   1.155 -            ldy #255
   1.156 -            jsr $fff4
   1.157 -            cpy #255
   1.158 -            bne main_wait_loop
   1.159 -
   1.160          jsr start_new_game
   1.161  
   1.162          level_loop: