Mini-tutorials Thread

Discussion in 'Tutorials' started by DeltaWooloo, Feb 16, 2021.

Tags:
  1. DeltaWooloo

    DeltaWooloo The noob next door Member

    Joined:
    Aug 7, 2019
    Messages:
    375
    I updated the first mini-tutorial guide thanks to djohe. just remove the subq.b command. Including this is necessary as it can cancel the speed shoes while you gain invincibility and that wears off.

    Although, one alternative solution djohe suggested is to have Sonic flash while he still has stars so there wouldn't be an extension to Sonic's invincibility. While I'm yet to test it as of writing, once I attempt to add it successfully, I'll update the post.
     
    Last edited: Jan 26, 2023
  2. JGamer2151

    JGamer2151 Well-Known Member/Lurker Member

    Joined:
    Dec 1, 2020
    Messages:
    95
    (bump; sorry)
    This is more of a personal preference, but the other method that I did was putting the music loader under "Title_ChkLevSel" after the checks for the level select code and when button A is pressed. This was based on a method that was done in the Sonic 2 Simon Wai beta.

    For reference:
    Code:
    Title_ChkLevSel:
            tst.b    ($FFFFFFE0).w    ; check    if level select    code is    on
            beq.w    PlayLevel    ; if not, play level
            btst    #6,($FFFFF604).w ; check if A is pressed
            beq.w    PlayLevel    ; if not, play level
            move.b  #$XX,d0    ; "XX" is the ID number of the music you want to play
            bsr.w   PlaySound   ; play music
            moveq    #2,d0
            bsr.w    PalLoad2    ; load level select pallet
            lea    ($FFFFCC00).w,a1
            moveq    #0,d0
            move.w    #$DF,d1
    
    But yes, any of those you've mentioned above will also work.
     
    Dark Shamil Khan and EddyTF like this.
  3. EddyTF

    EddyTF somebody once told me Member

    Joined:
    Jan 9, 2022
    Messages:
    70
    Location:
    Russia
    JGamer2151 likes this.
  4. JGamer2151

    JGamer2151 Well-Known Member/Lurker Member

    Joined:
    Dec 1, 2020
    Messages:
    95
    @EddyTF True. The location is up to the individual, anywhere near the level select code.
     
  5. ThDuckMaster

    ThDuckMaster Newcomer Trialist

    Joined:
    Feb 15, 2023
    Messages:
    1
    HOW TO MAKE THE LEVEL SELECT APPEAR WITHOUT THE CODE (SONIC 1 GITHUB)
    well to make this go to Tit_ChkLevSel
    Code:
    Tit_ChkLevSel:
            tst.b    (f_levselcheat).w ; delete this
            beq.w    PlayLevel    ; delete this
            btst    #bitA,(v_jpadhold1).w ; delete this
            beq.w    PlayLevel    ; delete this
            jmp Level_Select_Menu ; add this if you followed this guide: https://info.sonicretro.org/SCHG_How-to:Port_Sonic_2_Level_Select_to_Sonic_1
            moveq    #palid_LevelSel,d0
            bsr.w    PalLoad2    ; load level select palette
            lea    (v_hscrolltablebuffer).w,a1
            moveq    #0,d0
            move.w    #$DF,d1

    and done well its a really short tutorial but i didint see people making tutorials about this and is a little bit difficult to know how to not mess up every thing so uh well bye!
     
    Last edited: Jan 22, 2024
  6. newbegaplayer

    newbegaplayer Newcomer Prospect

    Joined:
    Feb 9, 2023
    Messages:
    10
    can you give me the dissasembly link?
     
  7. DeltaWooloo

    DeltaWooloo The noob next door Member

    Joined:
    Aug 7, 2019
    Messages:
    375
    It would've been helpful if you just do a Google search on "sonic 1 disassembly" and saw a GitHub repo or a link redirecting you to a list of disassemblies on Retro. Seeing as you asked nicely, click me to access the disassembly

    However, next time, it would've been better to do your research before immediately jumping to conclusions as it would've saved a lot of time on your end. :)
     
    EddyTF likes this.
  8. newbegaplayer

    newbegaplayer Newcomer Prospect

    Joined:
    Feb 9, 2023
    Messages:
    10
    no. i tried every sonic 2 beta 4 dissasembly but i couldnt find the labels. please give me the dissasembly you used;)
     
  9. newbegaplayer

    newbegaplayer Newcomer Prospect

    Joined:
    Feb 9, 2023
    Messages:
    10
    hey. when i tried to to the a button tutorial. i get an error at line 32792. its the blocks that pick eggman up.
     
  10. DeltaWooloo

    DeltaWooloo The noob next door Member

    Joined:
    Aug 7, 2019
    Messages:
    375
    You don't need to use another disassembly in order to implement this behaviour. Heck, I didn't even look at S2B4's disassembly to implement said behaviour. It was just luck after playing around with Sonic 1's code.

    It's only commenting out a few lines, you don't need to go through a barely documented disassembly in order to implement it. I clearly stated if you want to implement that feature in Sonic 1 implying that you should use a Sonic 1 disassembly like the link I sent you. Please re-read what I said next time and stop making things complicated for yourself.

    EDIT:
    It would be helpful if you show us the line specifically which will make things easier for us to lend you a hand.
     
    Last edited: Mar 19, 2023
  11. newbegaplayer

    newbegaplayer Newcomer Prospect

    Joined:
    Feb 9, 2023
    Messages:
    10
    oh! i see. sorry:confused:

    also.i thought this was the tutorial to fix the camera.
     
    Last edited by a moderator: Mar 19, 2023
  12. giovanni.gen

    giovanni.gen It's still Joe-vanni, not Geo-vanni. Member

    Joined:
    Apr 16, 2015
    Messages:
    313
    Location:
    Italy
    This doesn't give us sufficient information to help you. Once you regain posting privileges, I'd appreciate knowing in more detail what error(s) you're getting when assembling. Please provide the contents of your errors log.
     
    Inferno and DeltaWooloo like this.
  13. Grosy

    Grosy Romhacker + owns a mega drive 2 Member

    Joined:
    Dec 30, 2021
    Messages:
    38
    How to change sonics top speed (Sonic 1 github)
    THIS DOESNT WORK ON HIVEBRAIN ONLY ON GITHUB!

    Okay so lets begin first in the root of the disasembly open the file named "Sonic.asm" in a program like notepad (I will use notepad++ for this though).Now that you have opened the disasm you will search for the following code:

    *move.w #$600,(v_sonspeedmax).w ; Sonic's top speed
    Now that you have found the code change #$600 to for example to 800.
    Now build and congrats! You have changed the speed of sonic!


    NOTE:This does work on sonic 2 github and sonic 3 github but there are diffrent labels
    I also have provided a download for a disasembly that alredy has changed speed so if you are lazy to do it yourself here then and a rom is provided too for people who want to play it (even though its just a speed change). Also no need to credit me.
     

    Attached Files:

  14. Dark Shamil Khan

    Dark Shamil Khan TASer lol Member

    Joined:
    Nov 7, 2021
    Messages:
    90
    Location:
    Pakistan
    Umm. It also works on hivebrain Disassembly as well. You just need to find the right equivalent line. Here, v_sonspeedmax is a named variable for Sonic's max speed basically. It's basically equals to $FFFFF760.
    So, it'll be looking like this.
    move.w #$600,($FFFFF760).w ;Sonic's Top Speed
    But yeah, you can do it in hivebrain as well. Just need to know what ram is it equating to.
     
  15. Hame

    Hame Peepee Poopoo Member

    Joined:
    Jan 12, 2021
    Messages:
    56
    Location:
    Spain

    You can also change the acceleration and deceleration
     
  16. EddyTF

    EddyTF somebody once told me Member

    Joined:
    Jan 9, 2022
    Messages:
    70
    Location:
    Russia
    @Grosy perhaps you haven't told me everything. In addition to the basic speed, you can change the speed of speed shoes. I will take GitHub as a basis. So, you need to open 2E Monitor Content Power-Up in _incObj folder. Find Pow_ChkShoes and there you can see this line:

    Code:
    move.w    #$C00,(v_sonspeedmax).w ; change Sonic's top speed
    And you can set any speed. For example, #$300 and you will get slow shoes lol

    But wait! After the expiration of the Speed Shoes time, you will get the previous speed of 600, out of order. We need to correct this misunderstanding.

    Go in Sonic Display (incObj folder :p) and we need to find it:

    Code:
    move.w    #$600,(v_sonspeedmax).w ; restore Sonic's speed
    You need to replace this with your speed.

    And I haven't told you everything yet. Next, figure it out for yourself.
     
  17. Grosy

    Grosy Romhacker + owns a mega drive 2 Member

    Joined:
    Dec 30, 2021
    Messages:
    38
    Ok so i didnt know that until right now
     
  18. B.T.H Yeehaw!

    B.T.H Yeehaw! Newcomer Member

    Joined:
    Jun 20, 2020
    Messages:
    15
    Location:
    City Streets Zone
    How to disable Time Overs on the Sonic 1 GitHub Disassembly!

    It's actually a really simplistic thing to do, too! All you need to do is comment out three lines found in /_inc/HUD Update.asm on the TimeOver label!

    Code:
    TimeOver:
            clr.b    (f_timecount).w
    ;        lea    (v_player).w,a0 ;Comment out the following lines...
    ;        movea.l    a0,a2
    ;        bsr.w    KillSonic
    ;        move.b    #1,(f_timeover).w ;Until the move.b the sets the timeover flag. --B.T.H (Keep the rts, though.)
            rts    


    Now you can explore levels for more than 10 minutes at a time, because you've essentially removed the function that kills Sonic upon the 10 minute mark!
     
    Mega De Glitcher likes this.
  19. Dapperblook

    Dapperblook Newcomer Trialist

    Joined:
    Feb 20, 2023
    Messages:
    5
    Disable The Look Up And Down Lock While Balancing
    (Note: this is my first guide so if it some how causes a super mega duper memory leak and makes your rom hack explode or something please let me know, also this guide is for the Hivebrain 2005 Disassembly but it should be easy enough to translate)

    In the SMS Sonic games when you are on a ledge you enter the balancing state right? But theres a core difference from the genesis games and its that you can look up and down while balancing making it possible to spindash or peelout for maximum velocity while going off a ledge.
    ezgif.com-video-to-gif.gif

    This is something really cool that I wished more rom hacks did so im making a guide about it.

    Head to Sonic_Balance: and comment this:

    Code:
    Sonic_Balance:
            jsr    ObjHitFloor
            cmpi.w    #$C,d1
            blt.s    Sonic_LookUp
            cmpi.b    #3,$36(a0)
            bne.s    loc_12F62
    
    loc_12F5A:
            bclr    #0,$22(a0)
            bra.s    loc_12F70
    ; ===========================================================================
    
    loc_12F62:
            cmpi.b    #3,$37(a0)
            bne.s    Sonic_LookUp
    
    loc_12F6A:
            bset    #0,$22(a0)
    
    loc_12F70:
            move.b    #6,$1C(a0)    ; use "balancing" animation
    ;        bra.s    Obj01_ResetScr    ; This causes the up and down lock!
    Now you can look up and down while balancing, and if you implemented a balancing animation for looking away from the edge this might be it! (idk so probably not)

    but if you didn't while looking away from the ledge sonic is gonna get locked into looking right or left wich is kind of annoying. head to Obj01_NotRight: and Sonic_Balance: to comment these:
    Code:
    Obj01_NotRight:
            move.b    $26(a0),d0
            addi.b    #$20,d0
            andi.b    #$C0,d0        ; is Sonic on a    slope?
            bne.w    Obj01_ResetScr    ; if yes, branch
            tst.w    $14(a0)        ; is Sonic moving?
            bne.w    Obj01_ResetScr    ; if yes, branch
            bclr    #5,$22(a0)
            move.b    #5,$1C(a0)    ; use "standing" animation
            btst    #3,$22(a0)
            beq.s    Sonic_Balance
            moveq    #0,d0
            move.b    $3D(a0),d0
            lsl.w    #6,d0
            lea    ($FFFFD000).w,a1
            lea    (a1,d0.w),a1
            tst.b    $22(a1)
            bmi.s    Sonic_LookUp
            moveq    #0,d1
            move.b    $19(a1),d1
            move.w    d1,d2
            add.w    d2,d2
            subq.w    #4,d2
            add.w    8(a0),d1
            sub.w    8(a1),d1
            cmpi.w    #4,d1
    ;        blt.s    loc_12F6A    ;  comment this!
            cmp.w    d2,d1
            bge.s    loc_12F5A
            bra.s    Sonic_LookUp
    ; ===========================================================================
    
    Sonic_Balance:
            jsr    ObjHitFloor
            cmpi.w    #$C,d1
            blt.s    Sonic_LookUp
            cmpi.b    #3,$36(a0)
            bne.s    loc_12F62
    
    loc_12F5A:
    ;        bclr    #0,$22(a0)    ;  locks sonic into looking right!
            bra.s    loc_12F70
    ; ===========================================================================
    
    loc_12F62:
            cmpi.b    #3,$37(a0)
            bne.s    Sonic_LookUp
    
    ;loc_12F6A:
    ;        bset    #0,$22(a0)    ;  locks sonic into looking left!
    
    loc_12F70:
            move.b    #6,$1C(a0)    ; use "balancing" animation
    ;        bra.s    Obj01_ResetScr    ; This causes the up and down lock!

    Presto! now sonic doesnt get locked out of looking up, down, left or right! also if you dont have the looking away from the edge animation thing implemented and followed the thing above you should center the balancing animation mappings so it doesnt look too bad while balancing. also also if you are thinking about crediting me. don't. because this is stupid and easy to do.

    EDIT: spelling errors and I just realized I used quotes instead of code. whoops.
     
    Last edited: Jun 27, 2023
    Selbi and ProjectFM like this.
  20. giovanni.gen

    giovanni.gen It's still Joe-vanni, not Geo-vanni. Member

    Joined:
    Apr 16, 2015
    Messages:
    313
    Location:
    Italy
    [Sonic 2 Github] Make the WFZ cutscene skippable

    Don't you hate how long the WFZ cutscene takes to play out? Don't you wish you could simply skip it? This mini tutorial will teach you how in two simple steps and a few lines of code.

    Step 1) Edit the cutscene object

    The WFZ cutscene is entirely handled by an object, it being object B2, the Tornado. In the code, you'll notice the Tornado has multiple routines. Predictably enough, the relevant routine for the WFZ cutscene is the one for the ending of WFZ, labeled "ObjB2_Main_WFZ_End". The routine itself also features a bunch of secondary routines, but for our purposes, we need to look at the first one, it being labeled "ObjB2_Wait_Leader_position".

    This is the code featured in it in the vanilla game:

    Code:
    ObjB2_Wait_Leader_position:
        lea    (MainCharacter).w,a1     ; a1=character
        cmpi.w    #$5EC,y_pos(a1)        ; check if the player is here on the Y axis
        blo.s    +                    ; if not, return
        clr.w    (Ctrl_1_Logical).w    ; wipe all player inputs
        addq.w    #1,objoff_2E(a0)    ; add 1 to this timer
        cmpi.w    #$40,objoff_2E(a0)    ; check if 64 frames have passed
        bhs.s    ++                    ; if yes, branch
    + ; return_3A99E:
        rts                            ; else, return
    ; ===========================================================================
    + ; loc_3A9A0:
        addq.b    #2,routine_secondary(a0)    ; next routine
        ; from there forward, it sets a bunch of variables
    It's quite simple to understand. First, the game checks if the player has reached a coordinate low enough. Then, it checks if a timer has elapsed. If one of the two conditions does not apply, the game will run "ObjB2_Wait_Leader_position" on every single frame the object is ran. If both conditions are met, it adds 2 to the secondary routine counter, telling the game to go to the next routine (due to how jump tables work, routines are counted by twos under most circumstances, and not by ones, as one would expect).

    The edit involves allocating one byte of RAM, preferrably in some place that gets reset by the level. We'll call that byte "WFZ_Can_Skip", as it will determine whether or not the cutscene can be skipped.

    Now, depending on how much you care for performance, you may want to place it differently.

    Both of the methods involve the addition of this line:
    Code:
        st.b    (WFZ_Can_Skip).w    ; mark the cutscene as skippable
    The st.b instruction, or set true, sets every bit of a byte to 1. The result is that WFZ_Can_Skip will be equal to %11111111, or $FF, after the instruction is done.

    If you place it after the blo.s instruction, you will be able to skip the cutscene at the earliest moment possible, but it will be ran 64 times, which is unnecessary, admittedly.

    If you place it after the addq.b instruction, you will have to wait until Sonic starts moving to the right, before you can skip the cutscene, but the instruction will be ran only once.

    Where you place it is entirely your choice.

    Step 2) Make the game actually skip the cutscene

    Now, we need to implement a function that, when start is pressed, skips the cutscene. But first, let's talk about PauseGame.

    PauseGame is a function that is ran on every frame of gameplay. To put it simply, it checks whether or not the game is pausable, or paused already, and if it isn't, it checks for the player's pressure of the start button.

    See where I'm going here?

    Here's some code from the original game.

    Code:
        move.b    (Ctrl_1_Press).w,d0 ; is Start button pressed?
        or.b    (Ctrl_2_Press).w,d0 ; (either player)
        andi.b    #button_start_mask,d0
        beq.s    Pause_DoNothing    ; if not, branch
    +
        move.w    #1,(Game_paused).w    ; freeze time
    If start is pressed, normally, the game would just pause itself no problem. However, we can add a check above the instruction that sets Game_Paused to 1.

    The check is simple. If WFZ_Can_Skip is 0, we make the game act like it usually does. If WFZ_Can_Skip is not 0, we branch to new code that makes the game skip to DEZ. An inexperienced programmer would think of using this instruction:

    Code:
        cmpi.b    #0,(WFZ_Can_Skip).w
    While this instruction would work in combination with a bne instruction, which branches if not equal to zero, we can use a tst instruction, which is specifically to check if something is 0 or not 0, but does it faster and with slightly less ROM usage.

    Anyway, this is the code you're meant to add above the instruction that sets Game_Paused to 1:

    Code:
        tst.b    (WFZ_Can_Skip).w    ; are we in the middle of the WFZ cutscene?
        bne.s    SkipWFZCutscene        ; if yes, branch.
    Now, we need code for our destination. You might be wondering how to code a skip to DEZ. Luckily, the Tornado object from step 1 already has code in place for this express purpose!


    Code:
    ; loc_3AC40:
    
    ObjB2_Start_DEZ:
        move.w    #death_egg_zone_act_1,(Current_ZoneAndAct).w
    ; loc_3AC46:
    ObjB2_Deactivate_level:
        move.w    #1,(Level_Inactive_flag).w
        clr.b    (Last_star_pole_hit).w
        clr.b    (Last_star_pole_hit_2P).w
        rts
    The code is simple to explain. It sets the level to DEZ1, then it turns on the "Level_Inactive_flag", which restarts the level, and finally, it clears some checkpoint variables.

    We only need the code from it, not the labels. Our new label will be "SkipWFZCutscene", which we'll place right above Pause_Game. This is what it should look like:

    Code:
    SkipWFZCutscene:
        move.w    #death_egg_zone_act_1,(Current_ZoneAndAct).w
        move.w    #1,(Level_Inactive_flag).w
        clr.b    (Last_star_pole_hit).w
        clr.b    (Last_star_pole_hit_2P).w
        rts
    As you saw, the same code, but with none of its original labels.

    If you've followed the instructions correctly, you should be able to build the game, run it, go to WFZ, and test it out.