[FIXED] Ring counter does not update correctly if rings are subtracted

Discussion in 'Discussion & Q&A' started by Giovanni, Jul 24, 2017.

Thread Status:
Not open for further replies.
  1. Giovanni

    Giovanni It's Joe-vanni, not Geo-vanni. Member

    Joined:
    Apr 16, 2015
    Messages:
    311
    Location:
    Italy
    I'm creating some sort of joke hack for a friend, where monitors act the opposite of how they are meant to act.
    What's making me have problems is the ring monitor.
    The ring monitor is meant to subtract 10 rings from the ring counter, or to take all of them away if you don't have enough.
    On a technical side, this is fully functional, but on a graphical side, it works correctly only if you have 20+ rings.
    If I've got 11-19 rings, the HUD will not show the changes, despite the fact that you actually have lost 10 rings, and it will show your extra 10 rings until you don't actually get 10 rings.
    A demonstration can be found in this video:


    If, however, I have less than 10 rings, the ring counter will NOT underflow. It will go to 0, but the ring counter will not update. You will just see the flashing "RINGS" text.
    A demonstration can be found in this video:


    You may want to also check my code:

    Code:
    Pow_ChkRings:
            cmpi.b    #6,d0        ; does monitor contain 10 rings?
            bne.s    Pow_ChkS
    
            subi.w    #10,(v_rings).w    ; subtract 10 rings to the number of rings you have
            ori.b    #1,(f_ringcount).w ; update the ring counter
            cmpi.w    #0,(v_rings).w ; check if you should have less than 0 rings
            bge.s    Pow_RingSound
            clr.w        (v_rings).w ; sets ring count to 0
            ori.b        #1,(f_ringcount).w ; update the ring counter
    
        Pow_RingSound:
            music    sfx_Ring,1,0,0    ; play ring sound
     
    EMK-20218 likes this.
  2. AURORA☆FIELDS

    AURORA☆FIELDS so uh yes Exiled

    Joined:
    Oct 7, 2011
    Messages:
    759
    iirc you are just supposed to or $81 instead of 1 ro the ring counter update flag
     
  3. Giovanni

    Giovanni It's Joe-vanni, not Geo-vanni. Member

    Joined:
    Apr 16, 2015
    Messages:
    311
    Location:
    Italy
    I have tested this, and it works perfectly! This may come in handy in the future, so I'll keep it in mind.
    Thanks for your help and sorry for the basic question. I guess this thread can be locked.
     
Thread Status:
Not open for further replies.