Basic Questions and Answers Thread

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

  1. Giovanni

    Giovanni It's Joevanni, not Geovanni. Member

    Joined:
    Apr 16, 2015
    Messages:
    183
    Location:
    Italy
    The first three values determine if the SRAM should be on and how it should work. For more details on the matter, refer to this guide.

    "Revision" changes which revision of Sonic 1 you're hacking. Please look at the above comments to pick which revision you want to use.

    If you are hacking Revision 1 or higher, whenever you see two files named the same, with one's name followed by "(JP1)", you should be working with the JP1 file.

    "ZoneCount" determines how many zones there are supposed to be (it counts up from 0, and it includes the ending sequence). If you actually wish to add more zones beyond what's included in the game, please refer to this guide.

    "OptimiseSound" is a parameter I never tested before, and I've no clue what it does. However, if you wish to find out what it does, there are various "if" statements lying throughout the disassembly that check for "OptimiseSound". You can check the code there and see for yourself what it does.
     
    TheInvisibleSun and JGamer2151 like this.
  2. Stdh

    Stdh Newcomer Trialist

    Joined:
    Jan 11, 2021
    Messages:
    6
    so i always have this problem with sonlvl where im trying to edit art but it will break
    here is an example
    how the chunk looks
    61.png
    how it looks in game
    Schermafbeelding 2021-03-16 200016.png
    anyone know how to fix?
     
  3. Unavailable

    Unavailable Stuyding so I'm unavalible to speak. Member

    Joined:
    Aug 7, 2019
    Messages:
    285
    Location:
    England
    I'm going to keep this brief, but it should pretty easy to understand.

    The corrupted art in your screenshot is using VRAM for other objects. This is due to the new art you added, attempting to overlap the tiles due to the art for GHZ being in the way. When you examine the tileset in GHZ, you can see that some art is unused, loaded in the game. If I were you, I would try to remove the unused art, and since you're replacing the background, try and replace that art for that. You can try and do so via SonLVL by selecting the option to remove the unused art and tilesets. The only downside is you need to adjust the VRAM for some objects, such as the platforms but other than that, you should be good to go.
     
    Dewar likes this.
  4. JacobtheMan

    JacobtheMan Newcomer Trialist

    Joined:
    Jan 16, 2021
    Messages:
    6
    Hmm, quick question....

    How can I change the Sonic 1 HUD to the Sonic 2 HUD properly? I tried it one time and the HUD just became red like this:
    [​IMG]
     
  5. yami

    yami Newcomer Member

    Joined:
    Sep 24, 2020
    Messages:
    12
    Location:
    The Studio
    Sonic 2's HUD uses a different palette than the Sonic 1 HUD. Because of that, when porting it over, you have to change the color to the correct one.
    In Sonic 2, the brightest yellow (the HUD color) is in the same place as the red that you're seeing on your HUD right now.
     
  6. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    401
    Location:
    Town Creek, AL
    Sonic 1 Hivebrain
    I need help with a few things.
    My option screen, everything is good but.
    1. Play Game
    2. Ending Sequence
    3. Credits
    4. Special stage.
    with each one it winds up going back to the option screen
    Play game seems to work correctly until you complete Scrap Brain 2, then a few times "act clear" runs again. it eventually goes to where eggman jumps on the button, but it never transitions to SBZ3.
    Code:
    LevSel_PlaySonic1:
            cmpi.b    #2,(LevelSelectRam)
            beq    Character_Selector
            tst.b    (LevelSelectRam)
            bne    LevSel_NoMove
            cmpi.w    #$04,($FFFFFF82).w ; is    item $14 selected?
            bne    LevSel_Ending    ; if not, branch
            move.b    ($FFFFF605).w,d1
            andi.b    #ButtonStart,d1        ; is left/right    pressed?
            beq    LevSel_NoMove
           
            move.b    #$0C,($FFFFF600).w ; set screen    mode to    $18 (Ending)
            move.w    #$0000,($FFFFFE10).w ; set level    to 0600    (Ending)
            move.b    #3,($FFFFFE12).w ; set lives to    3
            moveq    #0,d0
            move.w    d0,($FFFFFE20).w ; clear rings
            move.l    d0,($FFFFFE22).w ; clear time
            move.l    d0,($FFFFFE26).w ; clear score       
           
            jmp    Level
    ; ===========================================================================
    LevSel_Ending:    cmpi.b    #2,(LevelSelectRam)
            beq    Character_Selector
            tst.b    (LevelSelectRam)    ; the Level Select
            bne    LevSel_NoMove        ; don't need this
            cmpi.w    #$05,($FFFFFF82).w ; is    item $05 selected?
            bne    LevSel_Credits    ; if not, branch
            move.b    ($FFFFF605).w,d1    ; save buttons to d1
            andi.b    #ButtonStart,d1        ; is left/right    pressed?
            beq    LevSel_NoMove        ; branch if not
                            ; I need to move this
                            ; XREF: LevelSelect
            move.b    #$18,($FFFFF600).w ; set screen    mode to    $18 (Ending)
            move.w    #$600,($FFFFFE10).w ; set level    to 0600    (Ending)
            jmp    EndingSequence
            rts       
    ; ===========================================================================
    
    LevSel_Credits:    cmpi.b    #2,(LevelSelectRam)
            beq    Character_Selector
            tst.b    (LevelSelectRam)
            bne    LevSel_NoMove
            cmpi.w    #$06,($FFFFFF82).w ; is    item $14 selected?
            bne    LevSel_Special    ; if not, branch
            move.b    ($FFFFF605).w,d1
            andi.b    #ButtonStart,d1        ; is left/right    pressed?
            beq    LevSel_NoMove
    
            move.b    #$1C,($FFFFF600).w ; set    screen mode to $0C (level)
           
            move.b    #3,($FFFFFE12).w ; set lives to    3
            moveq    #0,d0
            move.w    d0,($FFFFFE20).w ; clear rings
            move.l    d0,($FFFFFE22).w ; clear time
            move.l    d0,($FFFFFE22).w ; clear time
                move.l    d0,($FFFFFE26).w ; clear score
            move.b    d0,($FFFFFE30).w ; clear lamppost count
            subq.b    #1,($FFFFFE18).w ; subtract 1 from continues
            jmp    Credits   
    Levsel_Special:    cmpi.b    #2,(LevelSelectRam)
            beq    Character_Selector
            tst.b    (LevelSelectRam)
            bne    LevSel_NoMove
            cmpi.w    #$07,($FFFFFF82).w ; is    item $14 selected?
            bne    LevSel_sndtest    ; if not, branch
            move.b    ($FFFFF605).w,d1
            andi.b    #ButtonStart,d1        ; is left/right    pressed?
            beq.s    LevSel_NoMove
            move.b    #$10,($FFFFF600)
            jmp    SpecialStage
    
    
    what do i change to have it sucessfully transition SBZ2 - SBZ3 - Final - Ending - Credits, with these options correctly working? and having the special stage option working. I've tried everything. with Ending and special stage, no music or sounds play unless i go to the Credits option (which goes as far as "SONIC TEAM STAFF" before it goes to my Option screen) then selecting ending or special stage.
     
  7. Spicy Bread SSR

    Spicy Bread SSR Newcomer Prospect

    Joined:
    Feb 27, 2021
    Messages:
    10
    Location:
    Green Hills, Australia
    So, I'm trying to change the position of the dynamic animated tiles. Unlike normal animated tiles which just use a structure like this (Azure Lake)

    Code:
    AniPLC_ALZ:    zoneanimstart
    
        zoneanimdecl   9, ArtUnc_AniALZ, $23F,  3,$10 ; I was using an altered version for this example
        dc.b   0
        dc.b $10
        dc.b $20
        even
        zoneanimend
    
    Dynamic animated tiles are... (Mushroom Hill)

    Code:
    AnimateTiles_MHZ:
            lea    (Anim_Counters).w,a3
            moveq    #0,d0
            move.w    ($FFFFEEE4).w,d0
            sub.w    (Camera_X_pos_BG_copy).w,d0
            andi.w    #$1F,d0
            cmp.b    1(a3),d0
            beq.s    loc_28110
            move.b    d0,1(a3)
            moveq    #0,d1
            move.w    d0,d2
            andi.w    #7,d0
            lsl.w    #8,d0
            move.w    d0,d1
            move.l    d1,d5
            andi.w    #$18,d2
            move.w    d2,d0
            lsl.w    #3,d2
            add.w    d2,d1
            lsr.w    #1,d0
            lea    word_28114(pc,d0.w),a4
            lea    (ArtUnc_AniMHZ__BG).l,a0
            move.w    #$3700,d4    ; I think it's here?
            add.l    a0,d1
            move.w    d4,d2
            move.w    (a4)+,d3
            add.w    d3,d4
            add.w    d3,d4
            jsr    (Add_To_DMA_Queue).l
            move.l    d5,d1
            add.l    a0,d1
            move.w    d4,d2
            move.w    (a4)+,d3
            beq.s    loc_28110
            jsr    (Add_To_DMA_Queue).l
    
    loc_28110:
            addq.w    #2,a3
            bra.s    loc_28124
    ; ---------------------------------------------------------------------------
    word_28114:    dc.w $80
            dc.w 0
            dc.w $60
            dc.w $20
            dc.w $40
            dc.w $40
            dc.w $20
            dc.w $60
    ; ---------------------------------------------------------------------------
    
    loc_28124:
            moveq    #0,d1
            move.w    ($FFFFEEE2).w,d1
            sub.w    (Camera_X_pos_BG_copy).w,d1
            andi.w    #$3F,d1
            cmp.b    1(a3),d1
            beq.s    loc_28180
            move.b    d1,1(a3)
            move.w    d1,d2
            andi.w    #7,d1
            ror.w    #6,d1
            move.l    d1,d5
            andi.w    #$38,d2
            move.w    d2,d0
            lsl.w    #4,d2
            add.w    d2,d1
            lsr.w    #1,d0
            lea    word_28198(pc,d0.w),a4
            lea    (ArtUnc_AniMHZ__BG2).l,a0
            move.w    #$3AA0,d4       ; Again, I think it might be here...
            add.l    a0,d1
            move.w    d4,d2
            move.w    (a4)+,d3
            add.w    d3,d4
            add.w    d3,d4
            jsr    (Add_To_DMA_Queue).l
            move.l    d5,d1
            add.l    a0,d1
            move.w    d4,d2
            move.w    (a4)+,d3
            beq.s    loc_28180
            jsr    (Add_To_DMA_Queue).l
    
    loc_28180:
            addq.w    #2,a3
            move.b    (Anim_Counters+$F).w,d0
            addq.b    #2,d0
            cmpi.b    #$58,d0
            blo.s    loc_28190
            moveq    #0,d0
    
    loc_28190:
            move.b    d0,(Anim_Counters+$F).w
            bra.w    loc_286E8
    ; ---------------------------------------------------------------------------
    word_28198:    dc.w $200
            dc.w 0
            dc.w $1C0
            dc.w $40
            dc.w $180
            dc.w $80
            dc.w $140
            dc.w $C0
            dc.w $100
            dc.w $100
            dc.w $C0
            dc.w $140
            dc.w $80
            dc.w $180
            dc.w $40
            dc.w $1C0
    word_281B8:    dc.w $C0
            dc.w 0
            dc.w $90
            dc.w $30
            dc.w $60
            dc.w $60
            dc.w $30
            dc.w $90
    
    I know that most of this code is to track where Sonic is compared to the camera, I just can't figure out where the code is to change the VRAM offset, and how to read that code to change the position. Also Sonic 2 uses similar code for Hill Top, so this would also help others for normal hacks
     
  8. AURORA☆FIELDS

    AURORA☆FIELDS so uh yes Retired Staff

    Joined:
    Oct 7, 2011
    Messages:
    756
    yes, d4 is used as the VRAM location argument for
    Add_To_DMA_Queue. This is the raw VRAM position, which is 32x the tile number (for example objects use tile number instead of VRAM address). There's additional logic here to update at offsets from the provided VRAM location but you can shift the entire area with those instructions
     
  9. JacobtheMan

    JacobtheMan Newcomer Trialist

    Joined:
    Jan 16, 2021
    Messages:
    6
    Is there a program for that? I'm curious.
     
  10. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,837
    Location:
    italy
  11. JacobtheMan

    JacobtheMan Newcomer Trialist

    Joined:
    Jan 16, 2021
    Messages:
    6
    Thanks! I'll try it out.
    Actually, um.... wait... Is the HUD palette stored within another palette?
    (Sorry if these questions seem a little bit too much)
    [​IMG]
     
    Last edited: Mar 21, 2021
  12. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,837
    Location:
    italy
    Wait, what? You're not supposed to change the palette itself, that would break many other things, you have to edit the HUD art to reference another index (F instead of C) within the same palette.
     
    Green Hills likes this.
  13. JacobtheMan

    JacobtheMan Newcomer Trialist

    Joined:
    Jan 16, 2021
    Messages:
    6
    Oh, I'm fucking dumb. Lol, should've thought of it sooner...
     
  14. Spicy Bread SSR

    Spicy Bread SSR Newcomer Prospect

    Joined:
    Feb 27, 2021
    Messages:
    10
    Location:
    Green Hills, Australia
    So I find the new VRAM spot and multiply it by 32?
     
  15. Inferno

    Inferno Rom Hacker Member

    Joined:
    Oct 27, 2015
    Messages:
    77
    Location:
    Hidden Palace Zone, Westside Island
    Decimal 32, hex 20, and yes.
     
    TheInvisibleSun likes this.
  16. DarkerSS

    DarkerSS Newcomer Prospect

    Joined:
    Mar 26, 2021
    Messages:
    10
    Location:
    Metarex's Base
    Yes,DarkerSS Here Again... I have a question, even though I have consulted colleagues, no one can answer affirmatively, is there a way to port the third running animation in sonic cd?
    In sonic cd sonic have 3 running animations
    Walking
    Running (The sonic 1 animation)
    Running More Faster/Peel out, Is possible port this animation? for when sonic goes at a certain speed, run with that animation
    I am attentive to answers, thanks for reading
     
  17. yami

    yami Newcomer Member

    Joined:
    Sep 24, 2020
    Messages:
    12
    Location:
    The Studio
    I think I can condense this down into a simple enough message, though my wording might be off.

    First, you have to import the art to the main sprite sheet. This is best done with Flex 2, but can be done with other art editors.
    Then, you'll have to make an animation script, which shouldn't be hard, and it takes about 5-10 minutes depending on if you do it correctly the first time. The peelout animation is another variation of the running animation, which means that you can just copy that, and change the frame IDs.
    small reminder that frame IDs are in hex, not binary. I made this mistake when I was started editing animations.
    Next, in SonicAnimate.asm, you should copy the run animation check, and change the animation name, and speed (what the cmpi.w is comparing) to your desired value.

    Code:
    @nomodspeed:
            lea    (SonAni_XXXX).l,a1 ; use Peelout    animation
            cmpi.w    #$B00,d2    ; is Sonic at Dashing speed?
            bcc.s    @running    ; if yes, branch
    
            lea    (SonAni_Run).l,a1 ; use    running    animation
            cmpi.w    #$600,d2    ; is Sonic at running speed?
            bcc.s    @running    ; if yes, branch
    Here's mine for an example.
    If you want yours to be identical to Sonic CD's, then instead of #$B00, use #$A00.

    Basically, what it does is run a check for Sonic's speed, and if he's over that speed, he'll use the peelout animation.
    Replace XXXX with your animation name, and you should be good to go.
     
  18. DarkerSS

    DarkerSS Newcomer Prospect

    Joined:
    Mar 26, 2021
    Messages:
    10
    Location:
    Metarex's Base
    Thanks, later with my team we will try to implement it (I will upload progress to yt)
     
    Stdh likes this.
  19. DaSupaWaffle

    DaSupaWaffle Newcomer Trialist

    Joined:
    Aug 23, 2017
    Messages:
    8
    Location:
    United States
    Hey, I've come back to working on a hack after finishing some other projects and ran into some basic problems that I can't recall how to fix. First up is this problem where the loop chunk in GHZ isn't working properly, not changing between layers, so Sonic just flies off when he gets halfway instead of looping around. If you need any more info, I'd be glad to share it, and hopefully I can get back to working on this project again :) Here's a screenshot of the loop with its properties.
     

    Attached Files:

  20. yami

    yami Newcomer Member

    Joined:
    Sep 24, 2020
    Messages:
    12
    Location:
    The Studio
    Last message, so I don't think I'll be able to help anymore after this, but if you don't want to do any file editing, your loop chunk (with the collision on the right side) should be chunk 35, with the other loop chunk (with the collision on the left side) should be chunk 36.
    This is hard-coded into the game, but can be changed also, if you go into the LevelSizeLoad & BgScrollSpeed.asm in your disassembly, and change the numbers of the chunks.

    I think Ashuro explained it pretty well, which is
    Applying that logic, say I wanted to make my loop chunk $21, I'd add $80 to the chunk number, and there it is.
    Also, repeating somewhat what I said earlier, the chunk after your loop has to be the other loop chunk (the one with the different collision). This is because once Sonic reaches a certain point on the loop, the chunk will switch to the other chunk, so that Sonic can move through the loop without being permanently stuck.

    If you're using the Hivebrain disassembly, go to LoopTileNums, and replace the incbin with the table used in the GitHub version.