Sonic 2 Jump-Move Editor

Discussion in 'Utilities Archive' started by fantasticfish, Jun 16, 2009.

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

    fantasticfish The Fantastic Fish Member

    Joined:
    May 2, 2009
    Messages:
    73
    The description says it all.


    I've attached the script, ASM file, and setup file (which are mostly editable.)


    You can also edit script.txt, or you'll get the same move I first made.


    You can edit the ASM, just don't edit or remove anything in triple braces!!!!!!


    After the first use, s2.asm is the file to compile, and backup_s2.asm is the one to edit, changes will show up in s2.asm the next time you run S2ME.exe.


    Please try it!


    USE_s2ME_for_Xenowhirl_2007_Sonic_2_Disassembly.zip
     

    Attached Files:

  2. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,435
    Location:
    Northern Germany
    I'm using Vista 64 bit, so I can't run it. :p


    But I'm sure it does what it says. :p
     
  3. fantasticfish

    fantasticfish The Fantastic Fish Member

    Joined:
    May 2, 2009
    Messages:
    73

    Attached Files:

  4. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,435
    Location:
    Northern Germany
    Well, you should add some pictures so the user can look how this is working. For advice, look at this.
     
  5. fantasticfish

    fantasticfish The Fantastic Fish Member

    Joined:
    May 2, 2009
    Messages:
    73
    Using this is as easy as 1, 2, 3!


    1: Extract the files and look at them.


    /monthly_06_2009/post-740-1245175995_thumb.png


    2: Open setup.txt, and edit it. Rings cannot be 0.


    /monthly_06_2009/post-740-1245176002_thumb.png


    3: Double click S2ME.exe, and read s2.asm if desired, by searching your move's name and going to the second result.


    /monthly_06_2009/post-740-1245176008_thumb.png


    3 1/2: Also, you may notice a new file, backup_s2.asm. It is the template after you compile the script once. DO NOT DELETE IT!
     

    Attached Files:

    Last edited by a moderator: Jun 16, 2009
  6. Spanner

    Spanner The Tool Member

    Joined:
    Aug 9, 2007
    Messages:
    2,570
    I wonder how many people will use this...


    After all, if you visit Sofia there are some very good examples you could look at.
     
  7. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,435
    Location:
    Northern Germany
    Well SOTI, you are right, but I don't guess many people know Sofia, plus, there are only a very few examples (like your awesome test code =P). Also, it's still better when 5 people are using it instead of no one.
     
  8. amphobius

    amphobius spreader of the pink text Member

    Joined:
    Feb 24, 2008
    Messages:
    970
    Location:
    United Kingdom
    Sonic Ring Network is right in his fucking signature. Sofia is also on that site, so, where the hell did you get that from.
     
  9. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,435
    Location:
    Northern Germany
    It wasn't there at the time I posted this. :p
     
  10. fantasticfish

    fantasticfish The Fantastic Fish Member

    Joined:
    May 2, 2009
    Messages:
    73
    This isn't really discussion of my tool, is it?


    Well, I've improved it, and now it can do standing, rolling, in air, or jumping moves, and you specify whether you want to use A, B, or C to make the move happen. I may be uploading the newer version soon...
     
  11. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,435
    Location:
    Northern Germany
    A new version? Cool. But you said standing moves. Do you mean some kind of a Spindash?
     
  12. fantasticfish

    fantasticfish The Fantastic Fish Member

    Joined:
    May 2, 2009
    Messages:
    73
    If it works, it will do things like this: When standing you press B, and then you start spinning and going at high speed, as if you had just done a spindash. That is pretty far off, but step by step, I'm getting closer. Some time it probably will be able to make things like spindashes and peel-outs.


    EDIT: It already has the power of multiple new moves! (How astounding... :p)
     
    Last edited by a moderator: Jun 17, 2009
  13. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,435
    Location:
    Northern Germany
    I have a question, how is this program actualy working, I mean, what is it doing?
     
  14. fantasticfish

    fantasticfish The Fantastic Fish Member

    Joined:
    May 2, 2009
    Messages:
    73
    It uses templates. Here are the templates:



    Obj01_MdNormal:
    bsr.w Sonic_CheckSpindash


    bsr.w Sonic_Jump


    bsr.w Sonic_SlopeResist


    bsr.w Sonic_Move


    bsr.w Sonic_Roll


    bsr.w Sonic_LevelBound


    jsr ObjectMove


    bsr.w AnglePos


    bsr.w Sonic_SlopeRepel


    {{{ROUTINESTANDCALL}}}


    return_1A2DE:


    rts


    ; End of subroutine Obj01_MdNormal


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


    ; Start of subroutine Obj01_MdAir


    ; Called if Sonic is airborne, but not in a ball (thus, probably not jumping)


    ; loc_1A2E0: Obj01_MdJump


    Obj01_MdAir:


    bsr.w Sonic_JumpHeight


    bsr.w Sonic_ChgJumpDir


    bsr.w Sonic_LevelBound


    jsr ObjectMoveAndFall


    btst #6,status(a0) ; is Sonic underwater?


    beq.s + ; if not, branch


    subi.w #$28,y_vel(a0) ; reduce gravity by $28 ($38-$28=$10)


    +


    bsr.w Sonic_JumpAngle


    bsr.w Sonic_DoLevelCollision


    {{{ROUTINEAIRCALL}}}


    rts


    ; End of subroutine Obj01_MdAir


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


    ; Start of subroutine Obj01_MdRoll


    ; Called if Sonic is in a ball, but not airborne (thus, probably rolling)


    ; loc_1A30A:


    Obj01_MdRoll:


    tst.b spindash_flag(a0)


    bne.s +


    bsr.w Sonic_Jump


    +


    bsr.w Sonic_RollRepel


    bsr.w Sonic_RollSpeed


    bsr.w Sonic_LevelBound


    jsr ObjectMove


    bsr.w AnglePos


    bsr.w Sonic_SlopeRepel


    {{{ROUTINEROLLCALL}}}


    rts


    ; End of subroutine Obj01_MdRoll


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


    ; Start of subroutine Obj01_MdJump


    ; Called if Sonic is in a ball and airborne (he could be jumping but not necessarily)


    ; Notes: This is identical to Obj01_MdAir, at least at this outer level.


    ; Why they gave it a separate copy of the code, I don't know.


    ; loc_1A330: Obj01_MdJump2:


    Obj01_MdJump:


    bsr.w Sonic_JumpHeight


    bsr.w Sonic_ChgJumpDir


    bsr.w Sonic_LevelBound


    jsr ObjectMoveAndFall


    btst #6,status(a0) ; is Sonic underwater?


    beq.s + ; if not, branch


    subi.w #$28,y_vel(a0) ; reduce gravity by $28 ($38-$28=$10)


    +


    bsr.w Sonic_JumpAngle


    bsr.w Sonic_DoLevelCollision


    {{{ROUTINEJUMPCALL}}}


    rts


    ; End of subroutine Obj01_MdJump





    ; End of subroutine Sonic_CheckGoSuper

    {{{OURNEWMOVE}}}


    ; ---------------------------------------------------------------------------


    ; Subroutine doing the extra logic for Super Sonic


    ; ---------------------------------------------------------------------------



    And then a template for the move itself:



    Code:
    def makeMove():
    
    	if moveforwards:
    
    		DIRECTION = 10
    
    		ANTDIRECTION = 12
    
    		CHECKDIR="""{MNAME}_ChkDirection:
    
    \tbtst	#0,$22(a0)&#59; is sonic facing left?
    
    \tbeq.s	{MNAME}_MovePlayer	&#59; if yes, branch
    
    \tneg.w	d0	&#59; if not, negate d0 (for jumping to the right)""".replace('{MNAME}', OURNEWMOVENAME)
    
    	elif moveright:
    
    		DIRECTION = 10
    
    		ANTDIRECTION = 12
    
    		CHECKDIR="""{MNAME}_ChkDirection:
    
    \tneg.w	d0	&#59; negate d0 (for jumping to the right)""".replace('{MNAME}', OURNEWMOVENAME)
    
    	elif moveleft:
    
    		DIRECTION = 10
    
    		ANTDIRECTION = 12
    
    		CHECKDIR = ""
    
    	elif movedown:
    
    		DIRECTION = 12
    
    		ANTDIRECTION = 10
    
    		CHECKDIR = ""
    
    	elif moveup:
    
    		DIRECTION = 12
    
    		ANTDIRECTION = 10
    
    		CHECKDIR="""{MNAME}_ChkDirection:
    
    \tneg.w	d0	&#59; negate d0 (for jumping down)""".replace('{MNAME}', OURNEWMOVENAME)
    
    	else:
    
    		CHECKDIR="""{MNAME}_ChkDirection:
    
    \tneg.w	d0	&#59; negate d0 (for jumping down)""".replace('{MNAME}', OURNEWMOVENAME)
    
    		DIRECTION = 12
    
    		ANTDIRECTION = 10
    
    		
    
    	if sound:
    
    		soundPlay = """move.w	#${SOUND},d0	&#59; set sound
    
    \tjsr	(PlaySound).l&#59; play sound""".replace('{SOUND}', sound)
    
    	else:
    
    		soundPlay = ""
    
    			
    
    	if dotwice:
    
    		TESTFLAGPROCEDURE = ''
    
    		CLEARFLAGPROCEDURE = ''
    
    	else:
    
    		TESTFLAGPROCEDURE = """tst.b	($FFFFFFEB).w&#59; was the move flag set?
    
    \tbne.w	{MNAME}_End	&#59; if yes, branch
    
    \tmove.b	#1,($FFFFFFEB).w; if not, set move flag""".replace('{MNAME}', OURNEWMOVENAME)
    
    		CLEARFLAGPROCEDURE = "bclr	#4,$22(a0)&#59; clear move flag"
    
    
    
    	if minusrings:
    
    		takeRings = """cmpi.w	#{RINGS},(Ring_count).w; does Sonic have at least {RINGS} rings?
    
    \tbcs.s	{MNAME}_End&#59; if not, branch
    
    \tsubq.w	#{RINGS},(Ring_count).w; Subtract {RINGS} rings.
    
    \tori.b	#1,(Update_HUD_rings).w; Update the HUD.""".replace('{RINGS}', `minusrings`).replace('{MNAME}', OURNEWMOVENAME)
    
    	else:
    
    		takeRings = ""
    
    		
    
    	theProcedure = """
    
    ; ---------------------------------------------------------------------------
    
    ; Subroutine to perform a NEW move!!!!!!!!
    
    ; ---------------------------------------------------------------------------
    
    
    
    	{MNAME}:
    
    		btst	#{KEY},(Ctrl_1_Press).w
    
    		beq.w	{MNAME}_End; If not, branch
    
    		{TESTFLAG}
    
    		{SOUNDPLAY}
    
    		{TAKERINGS}
    
    		{CLEARFLAG}
    
    		move.w	#${SPEED},d0; set the speed to d0
    
    
    
    	{CHECKDIR}
    
    
    
    	{MNAME}_MovePlayer:
    
    		move.w	d0,${DIRECTION}(a0); Move Sonic...
    
    		{CLEAROTHER}
    
    
    
    	{MNAME}_End:
    
    		rts		&#59; return
    
    ; End of function {MNAME}"""
    
    
    
    	theProcedure = theProcedure.replace('{MNAME}', OURNEWMOVENAME)
    
    
    
    	theProcedure = theProcedure.replace('{KEY}', `keys[keyPress]`)
    
    
    
    	theProcedure = theProcedure.replace('{TESTFLAG}', TESTFLAGPROCEDURE)
    
    
    
    	theProcedure = theProcedure.replace('{CLEARFLAG}', CLEARFLAGPROCEDURE)
    
    
    
    	theProcedure = theProcedure.replace('{SOUNDPLAY}', soundPlay)
    
    	
    
    	if takeRings:
    
    		theProcedure = theProcedure.replace('{TAKERINGS}', takeRings)
    
    	else:
    
    		theProcedure = theProcedure.replace('{TAKERINGS}', '')
    
    		
    
    	theProcedure = theProcedure.replace('{SPEED}', `moveSpeed`)
    
    
    
    	theProcedure = theProcedure.replace('{CHECKDIR}', CHECKDIR)
    
    
    
    	theProcedure = theProcedure.replace('{DIRECTION}', `DIRECTION`)
    
    
    
    	co = """clr.w	${ANTDIRECTION}(a0); Stop Sonic's velocity in the other direction...""".replace('{ANTDIRECTION}', `ANTDIRECTION`)
    
    	if not clearOther: co = ''
    
    
    
    	theProcedure = theProcedure.replace('{CLEAROTHER}', co)
    
    	
    
    	return Move(theProcedure, type, OURNEWMOVENAME)

    EDIT: I'd like to make it clear that the {MNAME: like Sonic_Leap}_ChkDirection procedure was entirely by Selbi.
     
    Last edited by a moderator: Jun 17, 2009
  15. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,435
    Location:
    Northern Germany
    Ah thanks, that would be helpful. I'm doing a Sonic 1 Move Editor in the moment. :p
     
  16. fantasticfish

    fantasticfish The Fantastic Fish Member

    Joined:
    May 2, 2009
    Messages:
    73
    Cool! You'd be welcome to use my source code if you like, since with very little modification, it could do the other game.
     
  17. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,435
    Location:
    Northern Germany
    No, I will do it with VB because I kinda can't and want to work with anything else. :p
     
  18. fantasticfish

    fantasticfish The Fantastic Fish Member

    Joined:
    May 2, 2009
    Messages:
    73
    Cool.
     
  19. fantasticfish

    fantasticfish The Fantastic Fish Member

    Joined:
    May 2, 2009
    Messages:
    73
    A new version! (Sorry for the double post...)


    This time, you edit moves.txt to direct to various move files like the original setup.txt. There are two new flags, type and key (I think... :p) and they are the type of move (standing and rolling don't work well,) and the key you press to use it.


    Updated_Version_S2ME.zip
     

    Attached Files:

  20. DeoxysKyogre

    DeoxysKyogre No idea what to put here .-. Member

    Joined:
    Jan 31, 2009
    Messages:
    298
    Fantasticfish... I use Windows XP. I try it, and it's NOT working. Can you make a version for XP, please? (I mean, the link's broken :'( )
     
    Last edited by a moderator: Jun 30, 2009
Thread Status:
Not open for further replies.