Enchancing Sonic 2

Discussion in 'Discussion and Q&A Archive' started by Machenstein, May 20, 2012.

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

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England

    It's your hack. You decide. If you ask everyone simple questions like these, you'll never get a hack to something you like. Just polite advice =P
     
  2. Machenstein

    Machenstein Active Member Member

    Joined:
    Aug 10, 2011
    Messages:
    34
    I already went ahead and decided on Act 2. Now to figure out how to move the boss from Act 3 to Act 2.


    EDIT: I reverted the modifications which attempted (the keyword being "attempt") to put the boss in Act 2. I'm gonna try again, but first to ask around for some tips.


    EDIT 2: I assume this is the code responsible for loading the boss at Act 3.



    ; return_E758:
    LevEvents_MTZ:


    rts


    ; ===========================================================================


    ; loc_E75A:


    LevEvents_MTZ3:


    moveq #0,d0


    move.b (Dynamic_Resize_Routine).w,d0


    move.w LevEvents_MTZ3_Index(pc,d0.w),d0


    jmp LevEvents_MTZ3_Index(pc,d0.w)


    ; ===========================================================================


    ; off_E768:


    LevEvents_MTZ3_Index: offsetTable


    offsetTableEntry.w LevEvents_MTZ3_Routine1 ; 0


    offsetTableEntry.w LevEvents_MTZ3_Routine2 ; 2


    offsetTableEntry.w LevEvents_MTZ3_Routine3 ; 4


    offsetTableEntry.w LevEvents_MTZ3_Routine4 ; 6


    offsetTableEntry.w LevEvents_MTZ3_Routine5 ; 8


    ; ===========================================================================


    ; loc_E772:


    LevEvents_MTZ3_Routine1:


    cmpi.w #$2530,(Camera_X_pos).w


    blo.s +


    move.w #$500,(Camera_Max_Y_pos_now).w


    move.w #$450,(Camera_Max_Y_pos).w


    move.w #$450,(Tails_Max_Y_pos).w


    addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_MTZ3_Routine2


    +


    rts


    ; ===========================================================================


    ; loc_E792:


    LevEvents_MTZ3_Routine2:


    cmpi.w #$2980,(Camera_X_pos).w


    blo.s +


    move.w (Camera_X_pos).w,(Camera_Min_X_pos).w


    move.w (Camera_X_pos).w,(Tails_Min_X_pos).w


    move.w #$400,(Camera_Max_Y_pos).w


    move.w #$400,(Tails_Max_Y_pos).w


    addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_MTZ3_Routine3


    +


    rts


    ; ===========================================================================


    ; loc_E7B8:


    LevEvents_MTZ3_Routine3:


    cmpi.w #$2A80,(Camera_X_pos).w


    blo.s +


    move.w #$2AB0,(Camera_Min_X_pos).w


    move.w #$2AB0,(Camera_Max_X_pos).w


    move.w #$2AB0,(Tails_Min_X_pos).w


    move.w #$2AB0,(Tails_Max_X_pos).w


    addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_MTZ3_Routine4


    move.w #MusID_FadeOut,d0


    bsr.w JmpTo3_PlayMusic


    clr.b (ScreenShift).w


    move.b #7,(Current_Boss_ID).w


    moveq #PLCID_MtzBoss,d0


    bsr.w JmpTo2_LoadPLC


    +


    rts


    ; ===========================================================================


    ; loc_E7F6:


    LevEvents_MTZ3_Routine4:


    cmpi.w #$400,(Camera_Y_pos).w


    blo.s +


    move.w #$400,(Camera_Min_Y_pos).w


    move.w #$400,(Tails_Min_Y_pos).w


    +


    addq.b #1,(ScreenShift).w


    cmpi.b #$5A,(ScreenShift).w


    blo.s ++


    bsr.w JmpTo_SingleObjLoad


    bne.s +


    move.b #ObjID_MTZBoss,id(a1) ; load obj54 (MTZ boss)


    +


    addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_MTZ3_Routine5


    move.w #MusID_Boss,d0


    bsr.w JmpTo3_PlayMusic


    +


    rts


    ; ===========================================================================


    ; loc_E82E:


    LevEvents_MTZ3_Routine5:


    move.w (Camera_X_pos).w,(Camera_Min_X_pos).w


    move.w (Camera_Max_X_pos).w,(Tails_Max_X_pos).w


    move.w (Camera_X_pos).w,(Tails_Min_X_pos).w


    rts



    What would I need to change here in order to make the boss appear at the end of Act 2 instead of Act 3?
     
    Last edited by a moderator: Jun 3, 2012
  3. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    You need to learn how to do this. Let me guide you through.


    MTZ1 and MTZ2 are obviously act 1 and act 2. BUT MTZ3 is act 1 of a different level slot (whereas MTZ4 is act 2 of the same level slot).


    MTZ1 and 2 go to the same level events, which is "LevEvents_MTZ". But both these acts do not do anything, hence why there is an rts. Now, the easiest way to do this so you can understand what's going on, is to do it this way. You want act 2 to load up the boss? Well, we need act 2 to go to "LevEvents_MTZ3" instead. "LevEvents_MTZ3" is for MTZ3 and 4, and MTZ3 loads up the boss. But, MTZ2 is currently going to "LevEvents_MTZ".


    So, change:



    LevEvents_MTZ:
    rts



    To this:



    LevEvents_MTZ3:
    rts



    Then, change this:



    LevEvents_MTZ3:
    moveq #0,d0


    move.b (Dynamic_Resize_Routine).w,d0


    move.w LevEvents_MTZ3_Index(pc,d0.w),d0


    jmp LevEvents_MTZ3_Index(pc,d0.w)



    to this:



    LevEvents_MTZ:
    moveq #0,d0


    move.b (Dynamic_Resize_Routine).w,d0


    move.w LevEvents_MTZ3_Index(pc,d0.w),d0


    jmp LevEvents_MTZ3_Index(pc,d0.w)



    Basically, all we've done here is switched the labels around. Can you see what's happening now? Both act 1 and 2 are going to LevEvents_MTZ which contains all the boss data. It's just now labelled differently. Act 3 and 4 are now going to the new "LevEvents_MTZ3" which simply rts's. So, we've switched them both around.


    So now, act 3 and 4 will not do anything and won't load up the boss. Act 2 will now load up the boss, but so will act 1. Before we fix that, let's move on.


    Next, look at LevEvents_MTZ3_Routine1. This routine is moving the camera up when you get to that platform that carrys you accross. You can tell it does this because if you go in MTZ3 at the camera's x_pos $2530, the camera moves up a bit, just before you get on the platform. I guess you don't want this as it's not actually anything to do with the boss.


    It's easy to get rid of. Simply, delete all this (EXCEPT FOR THE LABEL):



    LevEvents_MTZ3_Routine1:
    cmpi.w #$2530,(Camera_X_pos).w


    blo.s +


    move.w #$500,(Camera_Max_Y_pos_now).w


    move.w #$450,(Camera_Max_Y_pos).w


    move.w #$450,(Tails_Max_Y_pos).w


    addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_MTZ3_Routine2


    +


    rts



    So, you just have this:



    LevEvents_MTZ3_Routine1:



    We can use this label to check our act! So, insert this under LevEvents_MTZ3_Routine1:



    LevEvents_MTZ3_Routine1:
    tst.b (Current_Act).w ; Is it act 1?


    beq.s + ; If so, branch and rts


    addq.b #2,(Dynamic_Resize_Routine).w ; => LevEvents_MTZ3_Routine2


    +


    rts



    So, what's it doing here? Let me explain. First, it asks, is it act 1? If so, branch and rts. This will forever happen. So now, in MTZ1, nothing will happen! But, if it's act 2, it will NOT branch, and it will add 2 to the "Dynamic_Resize_Routine", then rts. This means, if act 2, after it's added 2 to the "Dynamic_Resize_Routine", it will never branch to this label again, and will start branching to "LevEvents_MTZ3_Routine2" and onwards. Ta-dah! All done. Wasn't so hard. Hope you understand this.


    So now, MTZ1, MTZ3 and MTZ4 will do nothing, whereas MTZ2 will load up the boss!


    A WORD OF WARNING. Doing it this way, the boss will load in the exact same co-ordinates as he would in MTZ3, so be aware of that. You can edit the x_pos an y_pos for him to load somewhere else, but the boss code will need editing too. It's be easier for you just to let him load where he normally does.


    EDIT: I forgot to mention, you might want to rename a lot of the labels from MTZ3 to MTZ (or MTZ2, whatever is easier for you), so you don't start to get confused. You don't have to and it will work either way, but renaming them may make it look a bit neater for any future references.
     
    Last edited by a moderator: Jun 3, 2012
  4. Machenstein

    Machenstein Active Member Member

    Joined:
    Aug 10, 2011
    Messages:
    34
    Are these the coordinates for the boss?



    Obj54_Init:
    [...]


    move.w #$2B50,x_pos(a0)


    move.w #$380,y_pos(a0)



    If so, how would I use them to locate the boss in Act 2? Would I use the numbers on the HUD in debug mode?
     
    Last edited by a moderator: Jun 3, 2012
  5. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    If you're not changing the boss' locations, then yes, you can find where the boss area is in MTZ3 (using debug mode), then make sure there's a boss area in the same place for act 2.
     
  6. Machenstein

    Machenstein Active Member Member

    Joined:
    Aug 10, 2011
    Messages:
    34
    The problem is Act 2 isn't as long as Act 3. With the boss now in Act 2, I have to get rid of the boundary that makes the camera stop scrolling at the end of Act 2. I already got rid of the signpost there. I'll be happy to extend Act 2 if I can get rid of that boundary somehow.
     
    Last edited by a moderator: Jun 4, 2012
  7. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    Hivebrain disassembly location: word_C054


    Xenowhirl disassembly location:WrdArr_LvlSize


    SVN disassembly location: LevelSize


    You can figure it out from there.
     
  8. Machenstein

    Machenstein Active Member Member

    Joined:
    Aug 10, 2011
    Messages:
    34
    Durr! I should really get more acquainted with the disassembly folders.


    Anyway, when the boss loads in Act 2, it looks like this for some reason.


    [​IMG]


    I can even go outside of the boss area.


    [​IMG]


    So... what next?
     
    Last edited by a moderator: Jun 4, 2012
  9. Irixion

    Irixion Well-Known Member Member

    Joined:
    Aug 11, 2007
    Messages:
    670
    Location:
    Ontario, Canada
    Okay stop right there--You have to plan out how you're going to do something before you do it. These are handled in level events, which you would know if you actually took a look at it before you decided to hop into it blindly.
     
  10. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    Well hey now, jumping in blindly is sometimes a good thing, you won't learn anything if you don't make mistakes! Ease up on the guy...
     
    Last edited by a moderator: Jun 4, 2012
  11. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    The boss looks weird because it's been moved to act 2. Act 2 is meant to load the signpost originally. It can't do both signpost and the boss. Because the boss is looking weird and you can still move to the left (like you can before making the signpost spin), it seems to me that the signpost is still enabled.


    I'm not going to tell you (otherwise you'll never learn), because it should be easy enough to find it and disable act 2 loading the signpost. Once you've done that, it "should" work.


    Please note: Deleting the signpost object in the level is not enough (as you may of already gathered). Have a look in your ASM file, and see what levels and/or acts are loading the signpost.
     
  12. Machenstein

    Machenstein Active Member Member

    Joined:
    Aug 10, 2011
    Messages:
    34
    It works!


    [​IMG]


    All it took was going here...



    SetLevelEndType:
    move.w #0,(Level_Has_Signpost).w ; set level type to non-signpost


    tst.w (Two_player_mode).w ; is it two-player competitive mode?


    bne.s LevelEnd_SetSignpost ; if yes, branch


    nosignpost.w emerald_hill_zone_act_2


    nosignpost.w metropolis_zone_act_3


    nosignpost.w wing_fortress_zone_act_1


    nosignpost.w hill_top_zone_act_2


    nosignpost.w oil_ocean_zone_act_2


    nosignpost.s mystic_cave_zone_act_2


    nosignpost.s casino_night_zone_act_2


    nosignpost.s chemical_plant_zone_act_2


    nosignpost.s death_egg_zone_act_1


    nosignpost.s aquatic_ruin_zone_act_2


    nosignpost.s sky_chase_zone_act_1



    ... and changing "nosignpost.w metropolis_zone_act_3" to "nosignpost.w metropolis_zone_act_2". It was just as easy as you said. Thanks for the big help.


    My next goal is to make Death Egg Zone into a full level. If Metropolis Zone Act 3 is Act 1 of a different level slot, would it be possible to take Act 3 and 4 of Metropolis Zone and turn them into Act 1 and 2 of the new Death Egg Zone?
     
    Last edited by a moderator: Jun 5, 2012
  13. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    It's possible, but pointless. There's already a DEZ1, so you can edit all that to whatever you want. There IS actually a DEZ2 already (every single level has two act slots). So you can use MTZ 3 and 4 for something else in the future.
     
  14. Machenstein

    Machenstein Active Member Member

    Joined:
    Aug 10, 2011
    Messages:
    34
    EDIT: Before I do anything else, I need to fix a major bug I just encountered. If you beat the boss in Wing Fortress Zone as Super Sonic and you still have over 50 rings during the cutscene with the Tornado, Sonic will transform when he jumps to the Tornado and fall to his death. How do I make it so that Sonic never transforms during the WFZ cutscene?


    EDIT 2: I found a small fix to the problem. I went to ObjB2 and found the subroutine responsible for the cutscene.



    ObjB2_Prepare_to_jump:
    bsr.w ObjB2_Waiting_animation


    addq.w #1,objoff_2A(a0)


    cmpi.w #$30,objoff_2A(a0)


    bne.s +


    addq.b #2,routine_secondary(a0)


    move.w #(button_A_mask<<8)|button_A_mask,(Ctrl_1_Logical).w


    move.w #$38,objoff_2E(a0)


    tst.b (Super_Sonic_flag).w


    beq.s +


    move.w #$28,objoff_2E(a0)


    +


    bsr.w ObjB2_Align_plane


    bra.w JmpTo45_DisplaySprite


    ; ===========================================================================


    ObjB2_Jump_to_plane:


    clr.w (Ctrl_1_Logical).w


    addq.w #1,objoff_2A(a0)


    subq.w #1,objoff_2E(a0)


    bmi.s +


    move.w #((button_right_mask|button_A_mask)<<8)|button_right_mask|button_A_mask,(Ctrl_1_Logical).w


    [...]



    I then replaced all instances of "button_A_mask" with button_B_mask. Since my hack uses the A button for Super Sonic transformation, I decided to simply use a button that isn't A, namely B. If there is a better solution, please tell me.
     
    Last edited by a moderator: Jun 6, 2012
  15. Machenstein

    Machenstein Active Member Member

    Joined:
    Aug 10, 2011
    Messages:
    34
    For a token of my graditude, I give you another rendition of my hack, now with a Metropolis Zone that has only two acts. Act 2 has been extended in order to reach the boss area.


    http://www.mediafire.com/?619d5377rdxpye9


    The next thing to do is make Tails fly. This is where I hope to develop a better understanding of the Sonic engine. I downloaded the disassembly for Sonic 3 & Knuckles and found this within the main ASM file.



    Tails_FlySwim_Unknown:
    tst.b 4(a0)


    bmi.s loc_13C3A


    addq.w #1,($FFFFF704).w


    cmpi.w #$12C,($FFFFF704).w


    bcs.s loc_13C50


    move.w #0,($FFFFF704).w


    move.w #2,($FFFFF708).w


    move.b #-$7F,$2E(a0)


    move.b #2,$2A(a0)


    move.w #0,$10(a0)


    move.w #0,$14(a0)


    move.b #-$10,$25(a0)


    bsr.w Tails_Set_Flying_Animation


    rts



    Is this the code that gives Tails the ability to fly? If so, how do I make it work with Sonic 2? If this next task proves to be too advanced for a beginner like me, I am open to making this a group project.
     
  16. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    That is part of the Tails flying code, but I'll be totally frank with you. For what you needed help with earlier on level-events and extending DEZ, porting tails flying code will be a little too advanced for you at this time. Especially when all of S3K's SST's mean different to S2's. It's not a simple copy and paste from S3K to S2.


    IIRC, that code you just posted is for when Tails respawns, not for when you're actually making him fly yourself.


    Also, if you cannot do it, it doesn't mean people will want to start helping you immediately. You're bound to make mistakes and not understand stuff straight away. And you may start over every now and then. It's part of the "hacking" life. Take my first hack for example. Compared to my "Sonic 2 Recreation", my first hack was shit. Ask anyone =P
     
  17. Machenstein

    Machenstein Active Member Member

    Joined:
    Aug 10, 2011
    Messages:
    34
    I'll be transparent with my intentions. My real aim is to finish this hack by November 24, the 20th anniversary of Sonic 2. While that's five months from now, I'm afraid it won't be enough time for me to learn everything I need to finish the hack. I'm still interested in learning more about ASM and how the instructions effect the gameplay, I just want to do something to commemorate Sonic Twosday.


    Honestly, I always intended this hack to be a group project from the beginning. My ultimate goal is to help make the community's version of Sonic 2, not just my version of Sonic 2. I'm not in it for the credit, I just want this project to be for Sonic 2 what Sonic 3 Complete is for Sonic 3 & Knuckles. That being said, I also plan on doing small experimental hacks that I hope will expand my ASM knowledge. That way, if I make a major mistake, I won't have to do a whole project all over again.
     
    Last edited by a moderator: Jun 7, 2012
  18. redhotsonic

    redhotsonic Also known as RHS Member

    Joined:
    Aug 10, 2007
    Messages:
    2,969
    Location:
    England
    I can almost guarantee that will not happen. I've also got plans to finish my hack by then for same reasons, and I've been at my hack for a couple of years. And I know I'll won't have it ready by then.


    EDIT: Spellings
     
    Last edited by a moderator: Jun 7, 2012
  19. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    You should use the post preview option more if you're concerned about spellings red...


    On subject though, finishing a hack; on your own; before that time period; whilst having the hack be a decent renditional phenomenon that'll impress many, is not so likely to happen, with help in a team project it is of course more likely to happen, but obtaining the respect of the members who know their stuff may take just as long.


    I don't like recommending people to give up on their projects, perhaps you would do good having a major go at it, but I'm still going to say it anyway:

    Find a different project to work on.

     
  20. Machenstein

    Machenstein Active Member Member

    Joined:
    Aug 10, 2011
    Messages:
    34
    Never mind my project. Do you guys even want a definitive version of Sonic 2? There's Sonic 3 Complete for Sonic 3 & Knuckles, Sonic CD 2011 for Sonic CD, and even Mercury's ReadySonic template for Sonic 1. What does Sonic 2 have? The Sonic Compilation version?


    And what about the Game Gear games? Oh sure, the community would love to see Game Gear levels in the Genesis Sonic games, but they would rather expend their resources on making hacks where you play as random characters in random levels instead. And while those hacks are impressive, I wish the resources used to make them could be used to enhance older Sonic titles too. I'm the only one willing to step up and remaster Sonic games that have shown their age in spite of my limited ASM skills.


    So fine, keep down-voting my posts and lowering my "charisma" into the negatives just because of my inexperience. I'm sorry I'm not Stealth or MarkeyJester or whoever you guys want me to be. At least I can say I tried.
     
    Last edited by a moderator: Jun 7, 2012
Thread Status:
Not open for further replies.