Selbi's Parallax Editor

Discussion in 'Utilities' started by Selbi, May 24, 2011.

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

    Selbi Plug in, baby. Retired Staff

    Joined:
    Jul 20, 2008
    Messages:
    2,398
    Location:
    Northern Germany
    This was actually started up as a tiny gag MarkeyJester and I had in the IRC. Neither of us ever expected it to turn into a real project, but now it is here and ready for duty! The greatest problem of this problem wasn't generating the actual code or creating that preview window, no, finding the perfect way to design a program like this, that is the real deal.


    *Insert huge wall of text, explaining the rest of the history of this program, nobody cares about.*


    That said, here's your download:


    Download


    Along with a screenshot:


    [​IMG]


    The usage should be somewhat self-explainority, which is why I don't feel a step-by-step tutorial should be necessary (if you have trouble with it though, just hit me up on IRC; I'm always online in #ssrg). For a teeny-tiny FAQ look at the ASM boxes below.


    To-Do List for upcoming versions:


    - Implenting support for absolute deformation.


    - Adding more speeds so you can create much smoother movement with multiple blocks. 17 possibilities is not enough, considering most of them are way too fast/slow.


    - Making the S2LVL project loader being able to load Sonic 1 levels.


    - Fixing any bugs and issues this program hid from me.


    Special Thanks:


    - MainMemory, for providing the two DLLs, making my life a lot easier and also for a lot of VB.NET related tips.


    - MarkeyJester, for providing additional information (optimizing, etc.).


    -----------------------------------------------------------------------------------------------


    Where to put the code:


    During private testing, one major problem pretty much all people who were unfamiliar with deformation had, was that they didn't know where to put this code. So here I will explain where that location is:


    In the deformation routine of your choice, locate this line:



    ; For Sonic 1:
    move.w ($FFFFF70C).w,($FFFFF618).w


    ; For Sonic 2:


    move.w ($FFFFEE0C).w,($FFFFF618).w



    And remove everything below that line all the way up to the end of the routine (except for the rts of course). Put your generated code in that location you just deleted.


    How to lock the background vertically in place:


    Due to the current status of this program, being unable to create absolute deformation, moving up/down will make the screen go apeshit in 90% of all cases. It is therefore advised, until a proper function has been implented (which will happen as soon as possible, don't worry), to lock the background vertically in place.


    To do so, once again locate this line:



    ; For Sonic 1:
    move.w ($FFFFF70C).w,($FFFFF618).w


    ; For Sonic 2:


    move.w ($FFFFEE0C).w,($FFFFF618).w



    And put the following line right above it:



    ; For Sonic 1:
    move.w #$xxxx,($FFFFF70C).w ; lock the background vertically in place


    ; For Sonic 2:


    move.w #$xxxx,($FFFFEE0C).w ; lock the background vertically in place



    The $xxxx has to be replaced with whatever location you want the background to be at. For references you can use SonED2. One chunk has a size of $100, so if you want the background to start at chunk 3 from the top, you put in $300.
     
  2. hitaxas

    hitaxas I can has super speed? Member

    Joined:
    Aug 13, 2007
    Messages:
    152
    Not sure why, but the code this program pumps out for me doesn't seem to do anything when I test it in game. I am using Sonic 2 2007 DASM.
     
  3. GalliumGrant

    GalliumGrant Void. Member

    Joined:
    May 11, 2010
    Messages:
    384
    Same here.
     
  4. FireRat

    FireRat "The grand imitator..." Member

    Joined:
    Oct 31, 2009
    Messages:
    541
    Hey, it's designed for a normal deform. system or Rev01? I tried with Rev01 and this didn't work correctly


    EDIT: Tested with the normal system, without success.
     
    Last edited by a moderator: May 25, 2011
  5. Selbi

    Selbi Plug in, baby. Retired Staff

    Joined:
    Jul 20, 2008
    Messages:
    2,398
    Location:
    Northern Germany
    Deform_LZ: ; XREF: Deform_Index
    move.w ($FFFFF73A).w,d4


    ext.l d4


    asl.l #7,d4


    move.w ($FFFFF73C).w,d5


    ext.l d5


    asl.l #7,d5


    bsr.w ScrollBlock1


    move.w ($FFFFF70C).w,($FFFFF618).w


    ;vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv


    lea ($FFFFCC00).w,a1


    move.w #$DF,d1


    move.w ($FFFFF700).w,d0


    neg.w d0


    swap d0


    move.w ($FFFFF708).w,d0


    neg.w d0


    loc_63C6:


    move.l d0,(a1)+


    dbf d1,loc_63C6


    move.w ($FFFFF646).w,d0


    sub.w ($FFFFF704).w,d0


    ;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


    rts


    ; End of function Deform_LZ



    This is the area you should delete and replace with the generated code. It works for both the original engine as well the REV01 engine for me, so does it for the Sonic 2 backgrounds, at least for me. :S
     
  6. EMK-20218

    EMK-20218 Eduardo Knuckles Member

    Joined:
    Aug 8, 2008
    Messages:
    1,028
    Location:
    Jardim Capelinha, São Paulo
    Strangely it is, you said for change the whole deformation with the new one. That is really true? (If I'm not going wrong)


    Because the deformation stuff generated by the program starts with this:



    lea ($FFFFCC00).w,a1



    I tried to remove all the data below it to insert my custom one, but I've just got a completely static background, like the DEZ one in S3K. It doesn't scrolls vertically and also horizontally, so I can't see if the deformation worked correctly. Fortunately the foreground scrolls correctly. What I'm making wrong?


    EDIT: Here's the code I did, it scrolls and deforms correctly but this has a strange problem with the horizontal scroll. What's the matter with this? My code seems to be okay for my eyes. :)


    Look the code: http://sonicresearch.org/pastebin?wrong-co...ange-here111944
     
    Last edited by a moderator: May 25, 2011
  7. FireRat

    FireRat "The grand imitator..." Member

    Joined:
    Oct 31, 2009
    Messages:
    541
    Ok. I tried to redo the original GHZ's background's deform, in the original deform. system.


    Here's the code: http://sonicresearch.org/pastebin?deform030536


    Works almost perfectly, except for the sky and the far mountains. That should be fixed if I change the general BG speed?


    EDIT: Don't worry, I got it fixed by changing ScrollBlock1 to ScrollBlock2.


    EDIT2: In the Rev01 system, I got it to work too with ScrollBlock1, but looks glitchy (May be fixed by changing the general BG's speed?)
     
    Last edited by a moderator: May 25, 2011
  8. M3k

    M3k h4x Member

    Joined:
    Jul 28, 2008
    Messages:
    37
    Amazing. Now I can stop using SYZ deformation code for my backgrounds.


    Might I suggest adding support to SonED project files? S2LVL is better(IMO), but SonED2 is far more used.
     
    Last edited by a moderator: May 27, 2011
  9. GalliumGrant

    GalliumGrant Void. Member

    Joined:
    May 11, 2010
    Messages:
    384
    Code:
    Deform_GHZAct1:
    
    		move.w	($FFFFF73A).w,d4
    
    		ext.l	d4
    
    		asl.l	#7,d4
    
    		move.w	($FFFFF73C).w,d5
    
    		ext.l	d5
    
    		asl.l	#7,d5
    
    		bsr.w	ScrollBlock1
    
    		move.w	($FFFFF70C).w,($FFFFF618).w
    
    		move.w	#$0100,($FFFFF70C).w; lock the background vertically in place
    
    		lea	($FFFFCC00).w,a1; load beginning address of horizontal scroll

    Eduardo, I think the problem lies in the fact that you put your Vertical BG Lock code under the "move.w ($FFFFF70C).w,($FFFFF618).w"


    code, not above it.
     
    Last edited by a moderator: May 30, 2011
Thread Status:
Not open for further replies.