Combo Twitches Between 1 and 0

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Post Reply
Scorpion Illuminati
Interested
Posts: 28
Joined: Fri Oct 02, 2015 4:58 pm

Combo Twitches Between 1 and 0

Post by Scorpion Illuminati » Mon Mar 14, 2016 8:42 am

Code: Select all


  ; start of green note code

  move.w (greennote_position_y), d1  ; green note position in d1

  btst #pad_button_left, d0  ; Check left pad

  bne.s @NoLeft  ; Branch if button off

  cmp.w d2, d1  ; is the player pressing too early

  blt.s @GreenNoteSafeArea  ; if so then don't accept it

  move.w #note_start_position_y, d1

  abcd d4, d3  ; increment the player's score

  abcd d6, d5  ; increment the player's combo meter

  bra @GreenNoteDone  ; continue through the rest of the code

@GreenNoteSafeArea:

  moveq #0, d5  ; player played too early so reset the player's combo

@GreenNoteDone:

@NoLeft:

  ; green note movement code

  add.w (tempo), d1  ; add the tempo

  cmp.w  #(note_plane_border_offset-note_bounds_bottom), d1  ; does the player miss the fret entirely

  blt.s @GreenNoteNotWithinBounds  ; branch if the player hasn't

  move.w #note_start_position_y, d1  ; otherwise the player has so move the arrow back to the top

@GreenNoteNotWithinBounds:

  move.w d1, (greennote_position_y)  ; set the left arrow's position normally


  ; start of red note code

  move.w (rednote_position_y), d1  ; red note position in d1

  btst #pad_button_right, d0  ; Check right pad

  bne.s @NoRight  ; Branch if button off

  cmp.w d2, d1  ; is the player pressing too early

  blt.s @RedNoteSafeArea  ; if so then don't accept it

  move.w #note_start_position_y, d1

  abcd d4, d3  ; increment the player's score

  abcd d6, d5  ; increment the the player's combo meter

  bra @RedNoteDone  ; continue through the rest of the code

@RedNoteSafeArea:

;  moveq #0, d5  ; player played too early so reset the player's combo

@RedNoteDone:

@NoRight:

  ; red note movement code

  add.w (tempo), d1  ; add the tempo

  cmp.w  #(note_plane_border_offset-note_bounds_bottom), d1  ; does the player miss the note entirely

  blt.s @RedNoteNotWithinBounds  ; branch if the player hasn't

  move.w #note_start_position_y, d1  ; otherwise the player has so move the note back to the top

@RedNoteNotWithinBounds:

  move.w d1, (rednote_position_y)  ; set the red note's position normally

...

  cmp.w #$9, d5  ; have the player reached a combo of 10

  bgt.s @SkipX1Multiplier  ; if not then branch to next step

  move.w #1, (multiplier)  ; set the multiplier to 1

  move.w #1, d4  ; set score delta to 1

@SkipX1Multiplier:

  cmp.w #$10, d5  ; has the player reached a combo of 10

  blt.s @SkipX2Multiplier  ; if not then branch to the next step

  move.w #2, (multiplier)  ; set the multiplier to 2

  move.w #2, d4  ; set score delta to 2

@SkipX2Multiplier:

  cmp.w #$20, d5  ; have the player reached a combo of 20

  blt.s @SkipX3Multiplier  ; if not then branch to the next step

  move.w #3, (multiplier)  ; set the multiplier to 3

  move.w #3, d4  ; set score delta to 3

@SkipX3Multiplier:

  cmp.w #$30, d5  ; have the player reached a combo of 30

  blt.s @SkipX4Multiplier  ; if not then branch to the next step

  move.w #4, (multiplier)  ; set the multiplier to 4

  move.w #4, d4  ; set score delta to 4

@SkipX4Multiplier:


  move.w d3, (score)  ; save the player's score

  move.w d4, (scoredelta)  ; save the score delta

  move.w d5, (combo)  ; save the player's combo

For some reason the combo resets to 0 regardless of wither the player hits too early or with perfect timing. :p In fact if you do time it correctly you can see the combo meter go to 1 briefly then back to 0. :) I tried to see if register d5 is changed anywhere between the fret checking code and where the player's combo gets saved to ram and no it's not changed anywhere else. :huh: Any assistance in this matter would be greatly appreciated.


Sincerely,


Scorpion Illuminati
Scorpion Illuminati - An open source rhythm game for the Sega Genesis
http://www.scorpionilluminati.tk

Post Reply