Commit f012e10

Nick committed on
More WIP changing how notes/effects are handled
commit f012e10c5e94dd26756392b2ae520a7b547ccbfe parent 6949094
1 changed files +21−9
Modifieddriver.z80 +21−9
@@ -122,7 +122,7 @@ DB "NF"
122 SECTION "Song Data", ROM0 122 SECTION "Song Data", ROM0
123 ;; order_cnt is the number of orders times 2 123 ;; order_cnt is the number of orders times 2
124 order_cnt: db 2 124 order_cnt: db 2
125 order1: dw updown ;; unreal ;; unreal;, lunawaves, lunawaves, unreal 125 order1: dw tfau_bass ;; unreal ;; unreal;, lunawaves, lunawaves, unreal
126 order2: dw empty ;; empty, unreal, unreal, lunawaves 126 order2: dw empty ;; empty, unreal, unreal, lunawaves
127 order3: dw empty 127 order3: dw empty
128 order4: dw empty 128 order4: dw empty
@@ -383,16 +383,16 @@ _lookup_note:
383 383
384 ld a, [hl] 384 ld a, [hl]
385 385
386 ;; If the note we found is greater than LAST_NOTE, then it's not a valid note
387 ;; and nothing needs to be updated.
388 cp LAST_NOTE
389 ret nc
390
391 ;; Store the loaded note value in channel_noteX 386 ;; Store the loaded note value in channel_noteX
392 ld h, d 387 ld h, d
393 ld l, e 388 ld l, e
394 ld [hl], a 389 ld [hl], a
395 390
391 ;; If the note we found is greater than LAST_NOTE, then it's not a valid note
392 ;; and nothing needs to be updated.
393 cp LAST_NOTE
394 ret nc
395
396 _convert_note: 396 _convert_note:
397 ;; Call with: 397 ;; Call with:
398 ;; Note number in A 398 ;; Note number in A
@@ -835,10 +835,16 @@ fx_porta_down:
835 835
836 fx_toneporta: 836 fx_toneporta:
837 jp nz, .do_toneporta 837 jp nz, .do_toneporta
838
838 ;; We're on tick zero, so just move the temp note value into the toneporta target. 839 ;; We're on tick zero, so just move the temp note value into the toneporta target.
839 ld d, 2 840 ld d, 3
840 call setup_channel_pointer 841 call setup_channel_pointer
841 842
843 ;; If the note is nonexistent, then just return
844 ld a, [hl-]
845 cp LAST_NOTE
846 ret nc
847
842 ld a, [temp_note_value] 848 ld a, [temp_note_value]
843 ld c, a 849 ld c, a
844 ld a, [temp_note_value+1] 850 ld a, [temp_note_value+1]
@@ -850,7 +856,8 @@ fx_toneporta:
850 ;; Don't call _playnote. This is done by grabbing the return 856 ;; Don't call _playnote. This is done by grabbing the return
851 ;; address and manually skipping the next call instruction. 857 ;; address and manually skipping the next call instruction.
852 pop hl 858 pop hl
853 ld a, 3 859 pop af
860 ld a, 14
854 add_a_to_hl 861 add_a_to_hl
855 jp hl 862 jp hl
856 863
@@ -961,15 +968,20 @@ _dosound:
961 ld a, l 968 ld a, l
962 ld [temp_note_value+1], a 969 ld [temp_note_value+1], a
963 970
964 jr nc, .after_note1 971 push af
965 972
966 ld e, 0 973 ld e, 0
967 call _doeffect 974 call _doeffect
968 975
976 pop af
977
978 jr nc, .after_note1
979
969 ld a, [temp_note_value] 980 ld a, [temp_note_value]
970 ld h, a 981 ld h, a
971 ld a, [temp_note_value+1] 982 ld a, [temp_note_value+1]
972 ld l, a 983 ld l, a
984
973 call _playnote1 ; 3 bytes 985 call _playnote1 ; 3 bytes
974 986
975 .after_note1: 987 .after_note1: