Basic Questions and Answers Thread

Discussion in 'Discussion & Q&A' started by Malevolence, Jul 7, 2009.

  1. BenjaminTheRaccoon

    BenjaminTheRaccoon I'm a Raccoon! The Raccooniest Raccoon to Raccoon! Member

    Joined:
    Jun 20, 2020
    Messages:
    15
    Location:
    The Dumpster Outside the Maccas
    I'm trying to figure out how to do a Tails only double jump for my Sonic 2 hack, but haven't had any luck, yet. Best results I've gotten is either causing Tails to be able to jump as many times as you want at the cost of losing momentum, or no jump at all but instead slingshotting him on slopes.

    What am I missing, here?
    (And yes, I'm aware I did clone the regular jump code to make this hot garbage, but it's the best I could do.)

    Code:
    Tails_DoubleJump:
        andi.b    #button_B_mask|button_C_mask|button_A_mask,d0 ; is A, B or C pressed?
        beq.w    Tails_DoubleJumpFinish    ; if not, return
        btst    d0,(Last_jump_press).w        ; did Tails jump again?
        beq.w    Tails_DoubleJumpFinish    ; if yes, Tails should not triple jump. ...Hopefully!
        moveq    #0,d0
        move.b    angle(a0),d0
        addi.b    #$80,d0
        bsr.w    CalcRoomOverHead
        cmpi.w    #6,d1        ; does Tails have enough room to jump?
        blt.w    Tails_DoubleJumpFinish    ; if not, branch
        move.w    #$680,d2
        btst    #6,status(a0)    ; Test if underwater
        beq.s    +
        move.w    #$380,d2    ; set lower jump speed if underwater
    +
        moveq    #0,d0
        move.b    angle(a0),d0
        subi.b    #$40,d0
        jsr    (CalcSine).l
        muls.w    d2,d1
        asr.l    #8,d1
        add.w    d1,x_vel(a0)    ; make Tails jump (in X... this adds nothing on level ground)
        muls.w    d2,d0
        asr.l    #8,d0
        add.w    d0,y_vel(a0)    ; make Tails jump (in Y)
        bset    #1,status(a0)
        bclr    #5,status(a0)
        addq.l    #4,sp
        move.b    #1,jumping(a0)
        clr.b    stick_to_convex(a0)
        move.w    #SndID_DoubleJump,d0
        jsr    (PlaySound).l    ; play double jumping sound
        move.b    #$F,y_radius(a0)
        move.b    #9,x_radius(a0)
        btst    #2,status(a0)
        bne.s    Tails_RollJumpDouble
        move.b    #$E,y_radius(a0)
        move.b    #7,x_radius(a0)
        move.b    #AniIDSonAni_Spring,anim(a0)    ; use "jumping" animation
        bset    #2,status(a0)
        addq.w    #1,y_pos(a0)
    
    Tails_DoubleJumpFinish:
        rts
    ; ---------------------------------------------------------------------------
    ; loc_1C6C4:
    Tails_RollJumpDouble:
        bset    #4,status(a0) ; set the rolling+jumping flag
        rts
    Edit: You may have noticed the conflicting spring animation used against the jumping animation comment, uhh... That's semi-intentional.
     
  2. AleDrawer2008

    AleDrawer2008 Newcomer Member

    Joined:
    Jun 14, 2021
    Messages:
    21
    Location:
    Somewhere in South America
    You need to use a flag or SST for it. And after that, you'll need to clear it when touching the floor. For Tails is Tails_ResetOnFloor
     
  3. RobiWanKenobi

    RobiWanKenobi Python Developer and ASM enthusiast Member

    Joined:
    Sep 10, 2022
    Messages:
    88
    Location:
    United States
    To fix the infinite jump, you clear the jumping(a0) flag
     
  4. BenjaminTheRaccoon

    BenjaminTheRaccoon I'm a Raccoon! The Raccooniest Raccoon to Raccoon! Member

    Joined:
    Jun 20, 2020
    Messages:
    15
    Location:
    The Dumpster Outside the Maccas
    Call me stupid on this one, but... Where would I have to clear the jumping flag?
     
  5. RobiWanKenobi

    RobiWanKenobi Python Developer and ASM enthusiast Member

    Joined:
    Sep 10, 2022
    Messages:
    88
    Location:
    United States
    In the double jump, instead of setting it, you clear it.

    Please tell me if you have more questions.
     
  6. penPhobic

    penPhobic Everything's all topsy-turvy now. Member

    Joined:
    Dec 11, 2016
    Messages:
    68
    Location:
    Basement
    What does "smpsModSet" do in asm?
     
  7. Kurk

    Kurk flesh Member

    Joined:
    Jul 30, 2016
    Messages:
    99
    Location:
    Kurkistan
    smpsModSet sets modulation. It takes 4 1-byte parameters: wait speed before modulation starts, the modulation speed, the change per step, and the number of steps.
     
    vladikcomper and giovanni.gen like this.
  8. AleDrawer2008

    AleDrawer2008 Newcomer Member

    Joined:
    Jun 14, 2021
    Messages:
    21
    Location:
    Somewhere in South America
    So, I was implementing an DPLC system to the signpost but, when I try to go to the signpost's location and touch it, this message appears. Crash.png
    The fact that appears in Clownacy's clownmdemu, but not in Kega nor Gens makes me think this is an "odd address" error, but cause of the usage of an older version of the sonic 1 disasm I had since a long time ago, I can't see the location of that error but thanks to the 68k disassembler, I can see that is one of the new funtions i added: Perform_DPLC from S3K
    Code:
    loc_8504A:
            move.w    (a2)+,d3        ; Art source offset
            move.l    d3,d1
            andi.w    #$FFF0,d1        ; Isolate all but lower 4 bits
            add.w    d1,d1
            add.l    a3,d1            ; Get final source address of art
            move.w    d4,d2            ; Destination VRAM address
            andi.w    #$F,d3
            addq.w    #1,d3
            lsl.w    #4,d3            ; d3 is the total number of words to transfer (maximum 16 tiles per transaction)
            add.w    d3,d4
            add.w    d3,d4
            jsr    (QueueDMATransfer).l    ; Add to queue
            dbf    d5,loc_8504A        ; Keep going
    Still can't see what I did wrong
     
  9. BL3H

    BL3H Newcomer Prospect

    Joined:
    Jul 19, 2022
    Messages:
    10
    Location:
    Tails' Workshop, Angel Island
    Anyone know why this happens? It always happens after I edit something in SonLVL...
    [​IMG]
     
  10. Devon

    Devon DROWN, DROWN, DROWN MYSELF! Member

    Joined:
    Aug 26, 2013
    Messages:
    1,400
    Location:
    your mom
    @BL3H
     
  11. Red2010 is now

    Red2010 is now A Normal RomHacker with occupations. Member

    Joined:
    Apr 24, 2023
    Messages:
    53
    Location:
    Somewhere in Spain
  12. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    417
    Location:
    Town Creek, AL
    Is the code to load it still in obj2E_Invinc? Or is part of its code loaded for the shields instead?
     
  13. Red2010 is now

    Red2010 is now A Normal RomHacker with occupations. Member

    Joined:
    Apr 24, 2023
    Messages:
    53
    Location:
    Somewhere in Spain
    Hmm...
    [​IMG]
    Working for sonic encore...Well...Before that spindash error wasn't there...
     
  14. Hame

    Hame Peepee Poopoo Member

    Joined:
    Jan 12, 2021
    Messages:
    61
    Location:
    Spain
    You should move Art_Dust (The dust art) closer to the spindash routine
     
    Last edited: Feb 24, 2024
  15. Red2010 is now

    Red2010 is now A Normal RomHacker with occupations. Member

    Joined:
    Apr 24, 2023
    Messages:
    53
    Location:
    Somewhere in Spain
    It helped me, thx
     
  16. Devon

    Devon DROWN, DROWN, DROWN MYSELF! Member

    Joined:
    Aug 26, 2013
    Messages:
    1,400
    Location:
    your mom
    More than likely, you are running into a bug with the Genesis' VDP DMA. When you set up a DMA, like you do with the spindash dust art, the source address will be the location of that in ROM divided by 2. As it copies the data, it will increment that address by 1 for each 16-bit word read. However, it seems to only properly increment the lower 16 bits of that source address, but not take into account the upper byte. As a result, for instance, if the address ends up going to $1FFFF, it will end up wrapping back around to $10000, instead of incrementing the 1 to make it $20000. In terms of raw addresses (multiplying the VDP DMA source address value by 2), this means that $3FFFE will become $20000. If you have a piece of art that crosses a $20000 byte (128 KiB) boundary like that, then you will get that corruption.

    The easiest thing to do is to keep the art within a $20000 boundary (i.e. 0-$1FFFF, $20000-$3FFFF, $40000-$5FFFF, etc.). You can figure out where a thing is located in the built ROM by taking a look at the associated listing file (they usually have the .lst file extenstion). Moving it closer to the spindash code seems to have done just that for you.

    Another thing you can do is make the DMA queueing function detect boundary crosses, and have it split a single DMA function into 2, so that the wrapping bug never occurs, preventing future issues with this sort of thing automatically. You can find such an implementation in the Sonic 3 & Knuckles disassembly (at function
    Add_To_DMA_Queue, when Sonic3_Complete is set), or Flamewing's Ultra DMA Queue.
     
  17. Red2010 is now

    Red2010 is now A Normal RomHacker with occupations. Member

    Joined:
    Apr 24, 2023
    Messages:
    53
    Location:
    Somewhere in Spain
    Unfortunately, I haven't heard from anyone who has made it possible to move this to github.. (I work in the AS branch)

    PD: I would have made an answer but the help system was bugged
     
  18. Devon

    Devon DROWN, DROWN, DROWN MYSELF! Member

    Joined:
    Aug 26, 2013
    Messages:
    1,400
    Location:
    your mom
    Both are made for use with AS. You should be able to get either implemented with some configuration and naming changes. Try giving it a shot yourself! Could help you understand porting things from one thing to another better.
     
  19. Red2010 is now

    Red2010 is now A Normal RomHacker with occupations. Member

    Joined:
    Apr 24, 2023
    Messages:
    53
    Location:
    Somewhere in Spain
    A couple of hours ago I adapted the ultra dma queque without modifying much of its options...

    What followed was a failed build where the game died when loading the level.
     
  20. AleDrawer2008

    AleDrawer2008 Newcomer Member

    Joined:
    Jun 14, 2021
    Messages:
    21
    Location:
    Somewhere in South America
    Try to use deltawoolo's tutorial but using the Original "DMA queue" file from here. Also, there's an instance of "VDP_port_control". change it to be only be lowercase. That worked for me