How to Add one more Act in Sonic 1

Discussion in 'Tutorials Archive' started by EMK-20218, Feb 6, 2010.

Thread Status:
Not open for further replies.
  1. EMK-20218

    EMK-20218 The Fuss Maker Exiled

    Joined:
    Aug 8, 2008
    Messages:
    1,067
    Location:
    Jardim Capelinha, São Paulo
    This tutorial is for the people that wants to add a extra Act in the levels of Sonic 1.


    In fact, all the levels in Sonic 1 already has 4 Act, but it appears only in Labyrinth Zone as Scrap Brain Act 3, but for the other levels it needs to be "activated".


    As example, i will explain how to create the Act 4 for GHZ, the procedure is the same.


    For the new layout:


    Search for Level_Index:, you will see this:



    Level_Index:
    dc.w Level_GHZ1-Level_Index, Level_GHZbg-Level_Index, byte_68D70-Level_Index


    dc.w Level_GHZ2-Level_Index, Level_GHZbg-Level_Index, byte_68E3C-Level_Index


    dc.w Level_GHZ3-Level_Index, Level_GHZbg-Level_Index, byte_68F84-Level_Index


    dc.w byte_68F88-Level_Index, Level_GHZbg-Level_Index, byte_68F88-Level_Index


    dc.w Level_LZ1-Level_Index, Level_LZbg-Level_Index, byte_69190-Level_Index


    dc.w Level_LZ2-Level_Index, Level_LZbg-Level_Index, byte_6922E-Level_Index


    dc.w Level_LZ3-Level_Index, Level_LZbg-Level_Index, byte_6934C-Level_Index


    dc.w Level_SBZ3-Level_Index, Level_LZbg-Level_Index, byte_6940A-Level_Index


    dc.w Level_MZ1-Level_Index, Level_MZ1bg-Level_Index, Level_MZ1-Level_Index


    dc.w Level_MZ2-Level_Index, Level_MZ2bg-Level_Index, byte_6965C-Level_Index


    dc.w Level_MZ3-Level_Index, Level_MZ3bg-Level_Index, byte_697E6-Level_Index


    dc.w byte_697EA-Level_Index, byte_697EA-Level_Index, byte_697EA-Level_Index


    ...



    Look the 8th line, you will see SBZ3 (LZ4) after LZ3.


    Look for the fourth line between GHZ3 and LZ1, there is where you will define the layout for the Act 4.


    The result will be:



    Level_Index:
    dc.w Level_GHZ1-Level_Index, Level_GHZbg-Level_Index, byte_68D70-Level_Index


    dc.w Level_GHZ2-Level_Index, Level_GHZbg-Level_Index, byte_68E3C-Level_Index


    dc.w Level_GHZ3-Level_Index, Level_GHZbg-Level_Index, byte_68F84-Level_Index


    dc.w Level_GHZ4-Level_Index, Level_GHZbg-Level_Index, byte_68F88-Level_Index


    dc.w Level_LZ1-Level_Index, Level_LZbg-Level_Index, byte_69190-Level_Index


    dc.w Level_LZ2-Level_Index, Level_LZbg-Level_Index, byte_6922E-Level_Index


    dc.w Level_LZ3-Level_Index, Level_LZbg-Level_Index, byte_6934C-Level_Index


    dc.w Level_SBZ3-Level_Index, Level_LZbg-Level_Index, byte_6940A-Level_Index


    dc.w Level_MZ1-Level_Index, Level_MZ1bg-Level_Index, Level_MZ1-Level_Index


    dc.w Level_MZ2-Level_Index, Level_MZ2bg-Level_Index, byte_6965C-Level_Index


    dc.w Level_MZ3-Level_Index, Level_MZ3bg-Level_Index, byte_697E6-Level_Index


    dc.w byte_697EA-Level_Index, byte_697EA-Level_Index, byte_697EA-Level_Index


    ...



    Paste this after Level_Index:



    Level_GHZ4: incbin levels\ghz4.bin
    even



    To the objects:


    Search for ObjPos_Index:


    You will see this:



    ObjPos_Index:
    dc.w ObjPos_GHZ1-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_GHZ2-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_GHZ3-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_GHZ1-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_LZ1-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_LZ2-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_LZ3-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_SBZ3-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_MZ1-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_MZ2-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_MZ3-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_MZ1-ObjPos_Index, ObjPos_Null-ObjPos_Index


    ...



    Look the line on Act 4 uses the same objects from Act 1, you will need to change it for the new Act:



    ObjPos_Index:
    dc.w ObjPos_GHZ1-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_GHZ2-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_GHZ3-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_GHZ4-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_LZ1-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_LZ2-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_LZ3-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_SBZ3-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_MZ1-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_MZ2-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_MZ3-ObjPos_Index, ObjPos_Null-ObjPos_Index


    dc.w ObjPos_MZ1-ObjPos_Index, ObjPos_Null-ObjPos_Index


    ...



    Put it down



    ObjPos_GHZ4: incbin objpos\ghz4.bin
    even



    Editing the resize routine:


    Make a search for Resize_GHZ:


    You will see this:



    Resize_GHZ:; XREF: Resize_Index
    moveq #0,d0


    move.b ($FFFFFE11).w,d0


    add.w d0,d0


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


    jmp Resize_GHZx(pc,d0.w)


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


    Resize_GHZx:


    dc.w Resize_GHZ1-Resize_GHZx


    dc.w Resize_GHZ2-Resize_GHZx


    dc.w Resize_GHZ3-Resize_GHZx



    You will need to create a new line to the Act 4 and make the changes to prevent problems with the layouts.


    Change into:



    Resize_GHZ:; XREF: Resize_Index
    cmpi.b #$4,($FFFFF600).w; title-screen


    beq LimiteTS


    moveq #0,d0


    move.b ($FFFFFE11).w,d0


    add.w d0,d0


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


    jmp Resize_GHZx(pc,d0.w)


    LimiteTS:


    move.w #$300,($FFFFF726).w; set lower y-boundary


    Resize_GHZx:


    dc.w Resize_GHZ1-Resize_GHZx; act 1


    dc.w Resize_GHZ2-Resize_GHZx; act2


    dc.w Resize_GHZ1-Resize_GHZx; act3


    dc.w Resize_GHZ3-Resize_GHZx; act4


    ...



    I'm using the Act 3 routine, this will insert the boss at the end of the Act 4.


    Put a comment on the content from the routines down and insert this line. DO NOT change or remove the routines that are between the following ones.



    ...

    Resize_GHZ1:


    move.w #$400,($FFFFF726).w; set lower y-boundary


    ...


    Resize_GHZ2:


    move.w #$400,($FFFFF726).w; set lower y-boundary


    ...


    Resize_GHZ3main:


    move.w #$400,($FFFFF726).w; set lower y-boundary


    ...



    These changes will prevent problem with the vertical level resize and able you to go to larger ways.


    Editing the level size:


    Open up the file lvl_size.bin in a hex editor:


    You will see this:



    00 04 00 00 24 BF 00 00 03 00 00 60 00 04 00 00
    1E BF 00 00 03 00 00 60 00 04 00 00 29 60 00 00


    03 00 00 60 00 04 00 00 2A BF 00 00 03 00 00 60


    ...



    This part refers to GHZ. Look that the sequence 00 04 00 00 XX XX 00 00 YY YY 00 60 is repeated 4 times, every byte set is designed for a Act.


    To change the horizontal level limit for the Act 4, change the values from the 2 bytes I marked with XX XX, in the case change the 2A BF to other value, i recommend 29 60 because the boss.


    In YY YY (vertical size) use the value 03 00to the Act 1 and 04 00 For the other Act.


    Editing the Sonic's start position:


    Open up the file sloc_lev.bin in a hex editor:


    You will see this:



    00 50 03 B0 00 50 00 FC 00 50 03 B0 00 80 00 A8
    00 60 00 6C 00 50 00 EC 00 50 02 EC 0B 80 00 00


    00 30 02 66 00 30 02 66 00 30 01 66 00 80 00 A8


    00 40 02 CC 00 40 01 4C 00 40 01 4C 00 80 00 A8


    00 30 03 BD 00 30 01 BD 00 30 00 EC 00 80 00 A8


    00 30 04 8C 00 30 07 4C 21 40 05 AC 00 80 00 A8


    06 20 01 6C 0E E0 01 6C 00 80 00 A8 00 80 00 A8



    Every Act has 4 bytes for the Sonic's start position. The first two bytes are the horizontal position, the next two are the vertical positionl


    The levels are stored in the order from his level IDs.


    Look that the values on the Act 4 are 00 80 00 A8, except for LZ.


    Just change these values to change the position of Sonic according with new layouts.


    Ediating the level order:


    Open up the file lvl_ord.bin in a hex editor:


    You will see this:



    00 01 00 02 02 00 00 00 01 01 01 02 03 00 05 02
    02 01 02 02 04 00 00 00 03 01 03 02 05 00 00 00


    04 01 04 02 01 00 00 00 05 01 01 03 00 00 00 00



    Check the sequence:


    01 01 01 02 03 00 05 02 (Lz)


    Starting from the Act 1, the next will be the Act 2 (01 01), from the Act 2 the next will be the Act 3 (01 02), From the Act 3 it will go to SLZ Act 1 (03 00), it continues until it comes into SBZ2 going to LZ4 (01 03) and it goes to the Final Zone (05 02) that appears in the sequence above.


    To change it in way to make from the GHZ3 it goes to GHZ4 then for MZ, change the GHZ sequence from it:


    00 01 00 02 02 00 00 00 (GHz)


    To it:


    00 01 00 02 00 03 02 00 (GHz)


    Then do the same for the other levels that you want to add the act 4. Well, this guide was originally written by New Sonic, and was translated for the english by Eduardo Knuckles.


    Every credit from it goes to New Sonic. I don't need to receive any credits if used. Enjoy!
     
  2. Guest

    ok, I tried to put in a 4th act to green hill zone, but I am stuck on putting the comments and inserting the lines on the resizing routines. exactly how, and were do I put them?
     
    Last edited: Feb 7, 2010
  3. theocas

    theocas #! Member

    Joined:
    Apr 10, 2010
    Messages:
    375
    Sorry for this huge-ass bump, but I also tried adding a 4th act to GHZ, and got it all to compile. But after the SONIC TEAM PRESENTS screen fades away, the game crashes. When I un-did my changes to the resizing, the game started and I beat the GHZ3 boss, the game crashed. Does anyone know what could cause the crash?
     
  4. EMK-20218

    EMK-20218 The Fuss Maker Exiled

    Joined:
    Aug 8, 2008
    Messages:
    1,067
    Location:
    Jardim Capelinha, São Paulo
    Ohh... A long time with no reply, huh? Sorry, dudes. I'm here right now.

    Just next to the existent ones. If you want, you can use the same resize data from another level/act or copy other data changing the data's label according you needs.

    Probably you did something wrongly. I tested the guide during this time on a clean source, this works fine for me. Did you tried to re-do the guide again?
     
  5. theocas

    theocas #! Member

    Joined:
    Apr 10, 2010
    Messages:
    375
    Yeah, I got it to work, but on my own as I completely forgot about this guide ^_^
     
  6. FireRat

    FireRat Do Not Interact With This User, Anywhere!!! Exiled

    Joined:
    Oct 31, 2009
    Messages:
    535
    Sorry for the bump, but you can also add another note:


    If you want move the boss to the 4th act, will not work correctly, due to the boundaries, the signpost art, and others. So, to fix that you can do this:


    - Search and go to SignPostArtLoad.


    - Change all that code to this, and you can use this as future reference if you want move other bosses:




    SignpostArtLoad: ; XREF: Level


    tst.w ($FFFFFE08).w ; is debug mode being used?


    bne.w Signpost_Exit ; if yes, branch


    cmpi.b #$00,($FFFFFE10).w ; is GHZ?


    beq.s Signpost_GHZ ; if yes, branch


    cmpi.b #2,($FFFFFE11).w ; is act number 02 (act 3)?


    beq.s Signpost_Exit ; if yes, branch


    jmp SignpostArtLoad_Cont


    Signpost_GHZ:


    cmpi.b #3,($FFFFFE11).w ; is act number 03 (act 4)?


    beq.s Signpost_Exit ; if yes, branch


    SignpostArtLoad_Cont:


    move.w ($FFFFF700).w,d0


    move.w ($FFFFF72A).w,d1


    subi.w #$100,d1


    cmp.w d1,d0 ; has Sonic reached the edge of the level?


    blt.s Signpost_Exit ; if not, branch


    tst.b ($FFFFFE1E).w


    beq.s Signpost_Exit


    cmp.w ($FFFFF728).w,d1


    beq.s Signpost_Exit


    move.w d1,($FFFFF728).w ; move left boundary to current screen position


    moveq #$12,d0


    bra.w LoadPLC2 ; load signpost patterns


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


    Signpost_Exit:


    rts


    ; End of function SignpostArtLoad



    - But, if you want move all the bosses to the 4th act, change



    cmpi.b #2,($FFFFFE11).w ; is act number 02 (act 3)?



    to



    cmpi.b #3,($FFFFFE11).w ; is act number 03 (act 4)?



    EDIT: Grammar.
     
    Last edited by a moderator: May 23, 2011
Thread Status:
Not open for further replies.