Mercury pwns Yuji Naka

Discussion in 'Engineering & Reverse Engineering' started by Mercury, Aug 14, 2010.

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

    Mercury

    His Name Is Sonic Tech Member
    A lot of people hate the Sonic 1 Special Stages. Watching YouTube playthroughs, you'll hear them profaned quite often.

    I'm pretty good at beating them, myself, but I still hate them. Because I'm scientifically minded, I tried to figure out just why this is so.

    Then it hit me - Sonic doesn't have a variable jump height. Unlike when he's in the normal zones, you can't just let go of the jump button to mitigate his upward velocity.

    Having noticed this, it struck me that it was most likely the largest contributor to the hate for the Special Stages. Because you don't have as much control over Sonic as you've become accustomed to from playing the normal zones, it's frustrating and unfair. Trying to navigate through cramped paths winds up being an exercise in hitting every bumper and and reverse block through no fault of you own - Sonic just makes a full jump no matter what you do.

    Well, it was clear - I had to remedy this. I looked in the disassembly, and lo! - there was an unused routine for reducing Sonic's jump height in the Special Stages. Of course, merely reactivating the routine would be far too simple a fix - there had to be more than that. After all, if it worked, why would it be deprecated in the first place?

    It turns out the unused routine is the same as the one from Sonic's normal code. It's deprecated because, in the Special Stages, Sonic's in a rotating maze, where up isn't always up. The routine is simply impotent at any angle other than 0.

    Well, Yuji Naka might be lazy, but I'm not - so I wrote a new routine that actually <I>does</I> work, at any angle.

    This is what I did, and if you follow the steps, you can, too. This is for the SVN disassembly:

    First, open "_incObj\09 Sonic in Special Stage.asm" and find the label "Obj09_InAir". Replace this line:

    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm" style="font-family:monospace;">&nbsp;
    <span style="color: #00bfff;">bsr</span>.<span style="color: #00bfff;">w</span> nullsub_2
    &nbsp;</pre><!--gc2--><!--CmJzci53CW51bGxzdWJfMgo=--><!--egc2--><!--g2--></div><!--eg2-->

    with this one:

    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm" style="font-family:monospace;">&nbsp;
    <span style="color: #00bfff;">bsr</span>.<span style="color: #00bfff;">w</span> Obj09_JumpHeight
    &nbsp;</pre><!--gc2--><!--CmJzci53CU9iajA5X0p1bXBIZWlnaHQK--><!--egc2--><!--g2--></div><!--eg2-->

    Now, find the "nullsub_2" label. This is the deprecated routine, and we need to replace it with the new one I wrote, "Obj09_JumpHeight". So replace these lines:

    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='geshimain'><!--eg1--><pre class="asm" style="font-family:monospace;">&nbsp;
    nullsub_2: <span style="color: #adadad; font-style: italic;">; XREF: Obj09_InAir</span>
    <span style="color: #00bfff;">rts</span>
    <span style="color: #adadad; font-style: italic;">; End of function nullsub_2</span>
    &nbsp;
    <span style="color: #adadad; font-style: italic;">; ===========================================================================</span>
    <span style="color: #adadad; font-style: italic;">; ---------------------------------------------------------------------------</span>
    <span style="color: #adadad; font-style: italic;">; unused subroutine to limit Sonic's upward vertical speed</span>
    <span style="color: #adadad; font-style: italic;">; ---------------------------------------------------------------------------</span>
    <span style="color: #00bfff;">move</span>.<span style="color: #00bfff;">w</span> <span style="color: #ff0000;">#</span>-<span style="color: #ff0000;">$</span><span style="color: #ff0000;">400</span>,<span style="font-weight:bold;">d1</span>
    <span style="color: #00bfff;">cmp</span>.<span style="color: #00bfff;">w</span> obVelY<span style="">(</span><span style="font-weight:bold;">a0</span><span style="">)</span>,<span style="font-weight:bold;">d1</span>
    <span style="color: #00bfff;">ble</span>.<span style="color: #00bfff;">s</span> locret_1BBB4
    <span style="color: #00bfff;">move</span>.<span style="color: #00bfff;">b</span> <span style="">(</span>v_jpadhold2<span style="">)</span>.<span style="color: #00bfff;">w</span>,<span style="font-weight:bold;">d0</span>
    <span style="color: #00bfff;">andi</span>.<span style="color: #00bfff;">b</span> <span style="color: #ff0000;">#</span>btnABC,<span style="font-weight:bold;">d0</span>
    <span style="color: #00bfff;">bne</span>.<span style="color: #00bfff;">s</span> locret_1BBB4
    <span style="color: #00bfff;">move</span>.<span style="color: #00bfff;">w</span> <span style="font-weight:bold;">d1</span>,obVelY<span style="">(</span><span style="font-weight:bold;">a0</span><span style="">)</span>
    &nbsp;
    locret_1BBB4:
    <span style="color: #00bfff;">rts</span>
    &nbsp;</pre><!--gc2--><!--Cm51bGxzdWJfMjoJCQkJOyBYUkVGOiBPYmowOV9JbkFpcgoJCXJ0cwkKOyBFbmQgb2YgZnVuY3Rpb24g
    bnVsbHN1Yl8yCgo7ID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09P
    T09PT09PT09PT09PT09PT09PT09PT09PT09PQo7IC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS
    0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQo7IHVudXNlZCBzdWJyb3V
    0aW5lIHRvIGxpbWl0IFNvbmljJiMzOTtzIHVwd2FyZCB2ZXJ0aWNhbCBzcGVlZAo7IC0tLS0tLS0tLS0t
    LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tL
    S0tLQoJCW1vdmUudwkjLSYjMDM2OzQwMCxkMQoJCWNtcC53CW9iVmVsWShhMCksZDEKCQlibGUucwlsb2
    NyZXRfMUJCQjQKCQltb3ZlLmIJKHZfanBhZGhvbGQyKS53LGQwCgkJYW5kaS5iCSNidG5BQkMsZDAKCQl
    ibmUucwlsb2NyZXRfMUJCQjQKCQltb3ZlLncJZDEsb2JWZWxZKGEwKQoKbG9jcmV0XzFCQkI0OgoJCXJ0
    cwo=--><!--egc2--><!--g2--></div><!--eg2-->

    with these:

    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='geshimain'><!--eg1--><pre class="asm" style="font-family:monospace;">&nbsp;
    <span style="color: #adadad; font-style: italic;">; ---------------------------------------------------------------------------</span>
    <span style="color: #adadad; font-style: italic;">; Subroutine to limit Sonic's upward vertical speed</span>
    <span style="color: #adadad; font-style: italic;">; ---------------------------------------------------------------------------</span>
    &nbsp;
    <span style="color: #adadad; font-style: italic;">; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||</span>
    &nbsp;
    &nbsp;
    Obj09_JumpHeight: <span style="color: #adadad; font-style: italic;">; XREF: Obj09_InAir</span>
    <span style="color: #00bfff;">move</span>.<span style="color: #00bfff;">b</span> <span style="">(</span>v_jpadhold2<span style="">)</span>.<span style="color: #00bfff;">w</span>,<span style="font-weight:bold;">d0</span> <span style="color: #adadad; font-style: italic;">; is the jump button up?</span>
    <span style="color: #00bfff;">andi</span>.<span style="color: #00bfff;">b</span> <span style="color: #ff0000;">#</span>btnABC,<span style="font-weight:bold;">d0</span>
    <span style="color: #00bfff;">bne</span>.<span style="color: #00bfff;">s</span> locret_1BBB4 <span style="color: #adadad; font-style: italic;">; if not, branch to return</span>
    <span style="color: #00bfff;">btst</span> <span style="color: #ff0000;">#</span><span style="color: #ff0000;">7</span>,obStatus<span style="">(</span><span style="font-weight:bold;">a0</span><span style="">)</span> <span style="color: #adadad; font-style: italic;">; did Sonic jump or is he just falling or hit by a bumper?</span>
    <span style="color: #00bfff;">beq</span>.<span style="color: #00bfff;">s</span> locret_1BBB4 <span style="color: #adadad; font-style: italic;">; if not, branch to return</span>
    <span style="color: #00bfff;">move</span>.<span style="color: #00bfff;">b</span> <span style="">(</span>v_ssangle<span style="">)</span>.<span style="color: #00bfff;">w</span>,<span style="font-weight:bold;">d0</span> <span style="color: #adadad; font-style: italic;">; get SS angle</span>
    <span style="color: #00bfff;">andi</span>.<span style="color: #00bfff;">b</span> <span style="color: #ff0000;">#</span><span style="color: #ff0000;">$</span><span style="color: #ff0000;">FC</span>,<span style="font-weight:bold;">d0</span>
    <span style="color: #00bfff;">neg</span>.<span style="color: #00bfff;">b</span> <span style="font-weight:bold;">d0</span>
    <span style="color: #00bfff;">subi</span>.<span style="color: #00bfff;">b</span> <span style="color: #ff0000;">#</span><span style="color: #ff0000;">$</span><span style="color: #ff0000;">40</span>,<span style="font-weight:bold;">d0</span>
    <span style="color: #00bfff;">jsr</span> <span style="">(</span>CalcSine<span style="">)</span>.<span style="color: #00bfff;">l</span>
    <span style="color: #00bfff;">move</span>.<span style="color: #00bfff;">w</span> obVelY<span style="">(</span><span style="font-weight:bold;">a0</span><span style="">)</span>,<span style="font-weight:bold;">d2</span> <span style="color: #adadad; font-style: italic;">; get Y speed</span>
    <span style="color: #00bfff;">muls</span>.<span style="color: #00bfff;">w</span> <span style="font-weight:bold;">d2</span>,<span style="font-weight:bold;">d0</span> <span style="color: #adadad; font-style: italic;">; multiply Y speed by sin</span>
    <span style="color: #00bfff;">asr</span>.<span style="color: #00bfff;">l</span> <span style="color: #ff0000;">#</span><span style="color: #ff0000;">8</span>,<span style="font-weight:bold;">d0</span> <span style="color: #adadad; font-style: italic;">; find the new Y speed</span>
    <span style="color: #00bfff;">move</span>.<span style="color: #00bfff;">w</span> obVelX<span style="">(</span><span style="font-weight:bold;">a0</span><span style="">)</span>,<span style="font-weight:bold;">d2</span> <span style="color: #adadad; font-style: italic;">; get X speed</span>
    <span style="color: #00bfff;">muls</span>.<span style="color: #00bfff;">w</span> <span style="font-weight:bold;">d2</span>,<span style="font-weight:bold;">d1</span> <span style="color: #adadad; font-style: italic;">; multiply X speed by cos</span>
    <span style="color: #00bfff;">asr</span>.<span style="color: #00bfff;">l</span> <span style="color: #ff0000;">#</span><span style="color: #ff0000;">8</span>,<span style="font-weight:bold;">d1</span> <span style="color: #adadad; font-style: italic;">; find the new X speed</span>
    <span style="color: #00bfff;">add</span>.<span style="color: #00bfff;">w</span> <span style="font-weight:bold;">d0</span>,<span style="font-weight:bold;">d1</span> <span style="color: #adadad; font-style: italic;">; combine the two speeds</span>
    <span style="color: #00bfff;">cmpi</span>.<span style="color: #00bfff;">w</span> <span style="color: #ff0000;">#</span><span style="color: #ff0000;">$</span><span style="color: #ff0000;">400</span>,<span style="font-weight:bold;">d1</span> <span style="color: #adadad; font-style: italic;">; compare the combined speed with the jump release speed</span>
    <span style="color: #00bfff;">ble</span>.<span style="color: #00bfff;">s</span> locret_1BBB4 <span style="color: #adadad; font-style: italic;">; if it's less, branch to return</span>
    <span style="color: #00bfff;">move</span>.<span style="color: #00bfff;">b</span> <span style="">(</span>v_ssangle<span style="">)</span>.<span style="color: #00bfff;">w</span>,<span style="font-weight:bold;">d0</span>
    <span style="color: #00bfff;">andi</span>.<span style="color: #00bfff;">b</span> <span style="color: #ff0000;">#</span><span style="color: #ff0000;">$</span><span style="color: #ff0000;">FC</span>,<span style="font-weight:bold;">d0</span>
    <span style="color: #00bfff;">neg</span>.<span style="color: #00bfff;">b</span> <span style="font-weight:bold;">d0</span>
    <span style="color: #00bfff;">subi</span>.<span style="color: #00bfff;">b</span> <span style="color: #ff0000;">#</span><span style="color: #ff0000;">$</span><span style="color: #ff0000;">40</span>,<span style="font-weight:bold;">d0</span>
    <span style="color: #00bfff;">jsr</span> <span style="">(</span>CalcSine<span style="">)</span>.<span style="color: #00bfff;">l</span>
    <span style="color: #00bfff;">muls</span>.<span style="color: #00bfff;">w</span> <span style="color: #ff0000;">#</span><span style="color: #ff0000;">$</span><span style="color: #ff0000;">400</span>,<span style="font-weight:bold;">d1</span>
    <span style="color: #00bfff;">asr</span>.<span style="color: #00bfff;">l</span> <span style="color: #ff0000;">#</span><span style="color: #ff0000;">8</span>,<span style="font-weight:bold;">d1</span>
    <span style="color: #00bfff;">move</span>.<span style="color: #00bfff;">w</span> <span style="font-weight:bold;">d1</span>,obVelX<span style="">(</span><span style="font-weight:bold;">a0</span><span style="">)</span>
    <span style="color: #00bfff;">muls</span>.<span style="color: #00bfff;">w</span> <span style="color: #ff0000;">#</span><span style="color: #ff0000;">$</span><span style="color: #ff0000;">400</span>,<span style="font-weight:bold;">d0</span>
    <span style="color: #00bfff;">asr</span>.<span style="color: #00bfff;">l</span> <span style="color: #ff0000;">#</span><span style="color: #ff0000;">8</span>,<span style="font-weight:bold;">d0</span>
    <span style="color: #00bfff;">move</span>.<span style="color: #00bfff;">w</span> <span style="font-weight:bold;">d0</span>,obVelY<span style="">(</span><span style="font-weight:bold;">a0</span><span style="">)</span> <span style="color: #adadad; font-style: italic;">; set the speed to the jump release speed</span>
    <span style="color: #00bfff;">bclr</span> <span style="color: #ff0000;">#</span><span style="color: #ff0000;">7</span>,obStatus<span style="">(</span><span style="font-weight:bold;">a0</span><span style="">)</span> <span style="color: #adadad; font-style: italic;">; clear "Sonic has jumped" flag</span>
    &nbsp;
    locret_1BBB4:
    <span style="color: #00bfff;">rts</span>
    &nbsp;</pre><!--gc2--><!--CjsgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
    LS0tLS0tLS0tLS0tLS0tLS0tCjsgU3Vicm91dGluZSB0byBsaW1pdCBTb25pYyYjMzk7cyB1cHdhcmQgd
    mVydGljYWwgc3BlZWQKOyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS
    0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KCjsgfHx8fHx8fHx8fHx8fHx8IFMgVSBCCVIgTyB
    VIFQJSSBOIEUgfHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8CgoKT2JqMDlfSnVt
    cEhlaWdodDoJCQkJOyBYUkVGOiBPYmowOV9JbkFpcgoJCW1vdmUuYgkodl9qcGFkaG9sZDIpLncsZDAJO
    yBpcyB0aGUganVtcCBidXR0b24gdXA/CgkJYW5kaS5iCSNidG5BQkMsZDAKCQlibmUucwlsb2NyZXRfMUJCQjQJCTsgaWYgbm90LCBicmFuY2gg
    dG8gcmV0dXJuCgkJYnRzdAkjNyxvYlN0YXR1cyhhMCkJCTsgZGlkIFNvbmljIGp1bXAgb3IgaXMgaGUga
    nVzdCBmYWxsaW5nIG9yIGhpdCBieSBhIGJ1bXBlcj8KCQliZXEucwlsb2Ny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JCW1vdmUudwlkMCxvYlZlbFkoYTApCQk7IHN
    ldCB0aGUgc3BlZWQgdG8gdGhlIGp1bXAgcmVsZWFzZSBzcGVlZAoJCWJjbHIJIzcsb2JTdGF0dXMoYTAp
    CQk7IGNsZWFyICZxdW90O1NvbmljIGhhcyBqdW1wZWQmcXVvdDsgZmxhZwoKbG9jcmV0XzFCQkI0OgoJC
    XJ0cwo=--><!--egc2--><!--g2--></div><!--eg2-->

    Next, go to the "Obj09_OnWall" label, and add this line directly after it:

    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm" style="font-family:monospace;">&nbsp;
    <span style="color: #00bfff;">bclr</span> <span style="color: #ff0000;">#</span><span style="color: #ff0000;">7</span>,obStatus<span style="">(</span><span style="font-weight:bold;">a0</span><span style="">)</span> <span style="color: #adadad; font-style: italic;">; clear "Sonic has jumped" flag</span>
    &nbsp;</pre><!--gc2--><!--CmJjbHIJIzcsb2JTdGF0dXMoYTApCTsgY2xlYXIgJnF1b3Q7U29uaWMgaGFzIGp1bXBlZCZxdW90OyBm
    bGFnCg==--><!--egc2--><!--g2--></div><!--eg2-->

    Now, go to the "Obj09_Jump" label, and after this line:

    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm" style="font-family:monospace;">&nbsp;
    <span style="color: #00bfff;">bset</span> <span style="color: #ff0000;">#</span><span style="color: #ff0000;">1</span>,obStatus<span style="">(</span><span style="font-weight:bold;">a0</span><span style="">)</span>
    &nbsp;</pre><!--gc2--><!--CmJzZXQJIzEsb2JTdGF0dXMoYTApCg==--><!--egc2--><!--g2--></div><!--eg2-->

    add this one:

    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm" style="font-family:monospace;">&nbsp;
    <span style="color: #00bfff;">bset</span> <span style="color: #ff0000;">#</span><span style="color: #ff0000;">7</span>,obStatus<span style="">(</span><span style="font-weight:bold;">a0</span><span style="">)</span> <span style="color: #adadad; font-style: italic;">; set "Sonic has jumped" flag</span>
    &nbsp;</pre><!--gc2--><!--CmJzZXQJIzcsb2JTdGF0dXMoYTApCTsgc2V0ICZxdW90O1NvbmljIGhhcyBqdW1wZWQmcXVvdDsgZmxh
    Zwo=--><!--egc2--><!--g2--></div><!--eg2-->

    Finally, go to the "Obj09_ChkBumper" label, and after this line:

    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm" style="font-family:monospace;">&nbsp;
    <span style="color: #00bfff;">bset</span> <span style="color: #ff0000;">#</span><span style="color: #ff0000;">1</span>,obStatus<span style="">(</span><span style="font-weight:bold;">a0</span><span style="">)</span>
    &nbsp;</pre><!--gc2--><!--CmJzZXQJIzEsb2JTdGF0dXMoYTApCg==--><!--egc2--><!--g2--></div><!--eg2-->

    add this one:

    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='codemain'><!--eg1--><pre class="asm" style="font-family:monospace;">&nbsp;
    <span style="color: #00bfff;">bclr</span> <span style="color: #ff0000;">#</span><span style="color: #ff0000;">7</span>,obStatus<span style="">(</span><span style="font-weight:bold;">a0</span><span style="">)</span> <span style="color: #adadad; font-style: italic;">; clear "Sonic has jumped" flag</span>
    &nbsp;</pre><!--gc2--><!--CmJjbHIJIzcsb2JTdGF0dXMoYTApCTsgY2xlYXIgJnF1b3Q7U29uaWMgaGFzIGp1bXBlZCZxdW90OyBm
    bGFnCg==--><!--egc2--><!--g2--></div><!--eg2-->

    <I>Et voilà!</I> Basically, what it does is it combines the X and Y speed using cos and sin to find how fast he's moving upward at the current angle. It compares this combined speed with the jump release speed ($400) and if it's greater, then it uses similar code to the normal jump to make Sonic move at $400 in the current angle. Simple.

    When my friend (who's always been bad at the Sonic 1 Special Stages by her own admission, and hasn't played them in years) tested it out, she got the Chaos Emerald on her first try!

    Yuji Naka has had to put up with a lot of shit in his time (not least of which the schoolyard bullies who taunted him in his youth for having a name that sounds for all the world like "huge knocker"), and now it's my turn to rub it in his face:

    PWN, Yuji Naka!

    <span style='color:#000000;background:#000000'>
    The false bravado in this post is for humorous purposes only. I actually admire Yuji Naka a lot, and I'm sure he could improve my code greatly after but a brief glance at it.
    </span>

    So, let me know what you think of this, or if you find any bugs.

    Here's the <a href="http://dl.dropbox.com/u/5437265/s1built.zip" target="_blank">built rom</a> with the fix applied.
     
  2. theocas

    theocas

    Tech Member
    346
    0
    0
    Wow, this is pretty nice! I tried it on 3 special stages and I got them all on my first try. Since I used the Hivebrain disasm, I just copied over the required Constants and Variables from the SVN disasm. I'm lazy.
    And my special stages rotated way faster and the Up buttons are pure mayhem. Usually Sonic would just get stuck in mid-air, but this fixed it. Thanks for the fix!
     
  3. amphobius

    amphobius

    where are the japanese shaman girls, lintahlo? Member
    Mercury for Super Tech Member, pl0x

    This has made a stitch in my side no-more—I'm pretty sure some of the S1 special stage flack might dissapear now, if this was a commercial ROM. =P
     
  4. Namo

    Namo

    take a screenshot of your heart Member
    2,915
    0
    0
    Not bad work here. This certainly makes them more bearable. :)
     
  5. Dark Sonic

    Dark Sonic

    I'll find the old avatar eventually Member
    12,060
    4
    18
    Working on my art!
    Not too shabby sir. Unfortunately I still hate the Sonic 1 special stages, but you at least made them easier... except that god damn 3rd stage D:
     
  6. Tweaker

    Tweaker

    Misfit
    12,389
    0
    0
    Interesting! I was always under the impression that the original behavior was intentional; it's pretty neat to know that there was code left over suggesting that it was supposed to work this way. Excellent find!
     
  7. FeliciaVal

    FeliciaVal

    Member
    690
    0
    0
    Spain
    ooh thank you very much for this :) too bad I'm still using the Hivebrain dissassembly and I'm not sure how to make it work there
     
  8. FraGag

    FraGag

    Tech Member
    659
    0
    0
    Québec, Canada
    an assembler
    I just noticed it when trying to get all rings in the special stages in [email protected] 2010 (which I did :P) and it just <I>amplified</I> my frustration. Now I just have to remember to actually hold the jump button down to do a full-height jump. :P Nicely done!
     
  9. Mad Echidna

    Mad Echidna

    Gone Oldbie
    5,219
    0
    0
    I propose this become a standard addition to all sonic hacks, as the 8 bit style egg prison has been :P
     
  10. MarkeyJester

    MarkeyJester

    My predecessors have nothing on me. Resident Jester
    A very interesting find, nice research!

    Of course, one thing I am still wondering is why Sonic moves directly up when jumping from slanted walls, not to say I want it more difficult, I just figured that Sonic's physics being very close to reality, that it would be considered or expected the jumping on a slant, will fource the character in the directional face of that slant.
     
  11. theocas

    theocas

    Tech Member
    346
    0
    0
    <!--quoteo(post=491234:date=Aug 14 2010, 09:25 AM:name=FeliciaVal)--><div class='quotetop'>QUOTE (FeliciaVal @ Aug 14 2010, 09:25 AM) <a href="index.php?act=findpost&pid=491234"><img src="public/style_images/retro/snapback.png"></a></div><div class='quotemain'><!--quotec-->ooh thank you very much for this :) too bad I'm still using the Hivebrain dissassembly and I'm not sure how to make it work there<!--QuoteEnd--></div><!--QuoteEEnd-->
    I used the Hivebrain disasm too, so I just copied these equates over from the SVN disasm (Some of them might not be used at all, I know that, but I couldn't sort it all out atm because I used more of them. I just got rid of the obvious ones.):
    <!--g1--><div class='geshitop'>Syntax Highlighted Code: ASM</div><div class='geshimain'><!--eg1--><pre class="asm" style="font-family:monospace;">&nbsp;
    obRender: equ <span style="color: #ff0000;">1</span> <span style="color: #adadad; font-style: italic;">; bitfield for x/y flip, display mode</span>
    obGfx: equ <span style="color: #ff0000;">2</span> <span style="color: #adadad; font-style: italic;">; palette line & VRAM setting (2 bytes)</span>
    obMap: equ <span style="color: #ff0000;">4</span> <span style="color: #adadad; font-style: italic;">; mappings address (4 bytes)</span>
    obX: equ <span style="color: #ff0000;">8</span> <span style="color: #adadad; font-style: italic;">; x-axis position (2-4 bytes)</span>
    obScreenY: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">A</span> <span style="color: #adadad; font-style: italic;">; y-axis position for screen-fixed items (2 bytes)</span>
    obY: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">C</span> <span style="color: #adadad; font-style: italic;">; y-axis position (2-4 bytes)</span>
    obVelX: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">10</span> <span style="color: #adadad; font-style: italic;">; x-axis velocity (2 bytes)</span>
    obVelY: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">12</span> <span style="color: #adadad; font-style: italic;">; y-axis velocity (2 bytes)</span>
    obInertia: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">14</span> <span style="color: #adadad; font-style: italic;">; potential speed (2 bytes)</span>
    obHeight: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">16</span> <span style="color: #adadad; font-style: italic;">; height/2</span>
    obWidth: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">17</span> <span style="color: #adadad; font-style: italic;">; width/2</span>
    obPriority: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">18</span> <span style="color: #adadad; font-style: italic;">; sprite stack priority -- 0 is front</span>
    obActWid: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">19</span> <span style="color: #adadad; font-style: italic;">; action width</span>
    obFrame: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">1A</span> <span style="color: #adadad; font-style: italic;">; current frame displayed</span>
    obAniFrame: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">1B</span> <span style="color: #adadad; font-style: italic;">; current frame in animation script</span>
    obAnim: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">1C</span> <span style="color: #adadad; font-style: italic;">; current animation</span>
    obNextAni: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">1D</span> <span style="color: #adadad; font-style: italic;">; next animation</span>
    obTimeFrame: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">1E</span> <span style="color: #adadad; font-style: italic;">; time to next frame</span>
    obDelayAni: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">1F</span> <span style="color: #adadad; font-style: italic;">; time to delay animation</span>
    obColType: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">20</span> <span style="color: #adadad; font-style: italic;">; collision response type</span>
    obColProp: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">21</span> <span style="color: #adadad; font-style: italic;">; collision extra property</span>
    obStatus: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">22</span> <span style="color: #adadad; font-style: italic;">; orientation or mode</span>
    obRespawnNo: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">23</span> <span style="color: #adadad; font-style: italic;">; respawn list index number</span>
    obRoutine: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">24</span> <span style="color: #adadad; font-style: italic;">; routine number</span>
    ob2ndRout: equ <span style="color: #ff0000;">$</span><span style="color: #ff0000;">25</span> <span style="color: #adadad; font-style: italic;">; secondary routine number</span>
    &nbsp;
    btnB: equ %00010000 <span style="color: #adadad; font-style: italic;">; B ($10)</span>
    btnR: equ %00001000 <span style="color: #adadad; font-style: italic;">; Right ($08)</span>
    btnL: equ %00000100 <span style="color: #adadad; font-style: italic;">; Left ($04)</span>
    btnDn: equ %00000010 <span style="color: #adadad; font-style: italic;">; Down ($02)</span>
    btnUp: equ %00000001 <span style="color: #adadad; font-style: italic;">; Up ($01)</span>
    btnDir: equ %00001111 <span style="color: #adadad; font-style: italic;">; Any direction ($0F)</span>
    btnABC: equ %01110000 <span style="color: #adadad; font-style: italic;">; A, B or C ($70)</span>
    bitStart: equ <span style="color: #ff0000;">7</span>
    bitA: equ <span style="color: #ff0000;">6</span>
    bitC: equ <span style="color: #ff0000;">5</span>
    bitB: equ <span style="color: #ff0000;">4</span>
    bitR: equ <span style="color: #ff0000;">3</span>
    bitL: equ <span style="color: #ff0000;">2</span>
    bitDn: equ <span style="color: #ff0000;">1</span>
    bitUp: equ <span style="color: #ff0000;">0</span>
    &nbsp;
    v_jpadhold2: = <span style="color: #ff0000;">$</span><span style="color: #ff0000;">FFFFF602</span> <span style="color: #adadad; font-style: italic;">; joypad input - held, duplicate</span>
    v_jpadpress2: = <span style="color: #ff0000;">$</span><span style="color: #ff0000;">FFFFF603</span> <span style="color: #adadad; font-style: italic;">; joypad input - pressed, duplicate</span>
    v_jpadhold1: = <span style="color: #ff0000;">$</span><span style="color: #ff0000;">FFFFF604</span> <span style="color: #adadad; font-style: italic;">; joypad input - held</span>
    v_jpadpress1: = <span style="color: #ff0000;">$</span><span style="color: #ff0000;">FFFFF605</span> <span style="color: #adadad; font-style: italic;">; joypad input - pressed</span>
    v_ssangle: = <span style="color: #ff0000;">$</span><span style="color: #ff0000;">FFFFF780</span> <span style="color: #adadad; font-style: italic;">; Special Stage angle (2 bytes)</span>
    v_ssrotate: = <span style="color: #ff0000;">$</span><span style="color: #ff0000;">FFFFF782</span> <span style="color: #adadad; font-style: italic;">; Special Stage rotation speed (2 bytes)</span></pre><!--gc2--><!--Cm9iUmVuZGVyOgllcXUgMQk7IGJpdGZpZWxkIGZvciB4L3kgZmxpcCwgZGlzcGxheSBtb2RlCm9iR2Z4
    OgkJZXF1IDIJOyBwYWxldHRlIGxpbmUgJmFtcDsgVlJBTSBzZXR0aW5nICgyIGJ5dGVzKQpvYk1hcDoJC
    WVxdSA0CTsgbWFwcGluZ3MgYWRkcmVzcyAoNCBieXRlcykKb2JYOgkJZXF1IDgJOyB4LWF4aXMgcG9zaX
    Rpb24gKDItNCBieXRlcykKb2JTY3JlZW5ZOgllcXUgJiMwMzY7QQk7IHktYXhpcyBwb3NpdGlvbiBmb3I
    gc2NyZWVuLWZpeGVkIGl0ZW1zICgyIGJ5dGVzKQpvYlk6CQllcXUgJiMwMzY7Qwk7IHktYXhpcyBwb3Np
    dGlvbiAoMi00IGJ5dGVzKQpvYlZlbFg6CQllcXUgJiMwMzY7MTAJOyB4LWF4aXMgdmVsb2NpdHkgKDIgY
    nl0ZXMpCm9iVmVsWToJCWVxdSAmIzAzNjsxMgk7IHktYXhpcyB2ZWxvY2l0eSAoMiBieXRlcykKb2JJbm
    VydGlhOgllcXUgJiMwMzY7MTQJOyBwb3RlbnRpYWwgc3BlZWQgKDIgYnl0ZXMpCm9iSGVpZ2h0OgllcXU
    gJiMwMzY7MTYJOyBo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==--><!--egc2--><!--g2--></div><!--eg2-->
     
  12. Aquaslash

    Aquaslash

    Emerald Dragoon Moderator
    2,818
    0
    0
    Hampton, VA
    The S Factor: Sonia and Silver
    <!--quoteo(post=491279:date=Aug 14 2010, 02:58 PM:name=Mad Echidna)--><div class='quotetop'>QUOTE (Mad Echidna @ Aug 14 2010, 02:58 PM) <a href="index.php?act=findpost&pid=491279"><img src="public/style_images/retro/snapback.png"></a></div><div class='quotemain'><!--quotec-->I propose this become a standard addition to all sonic hacks, as the 8 bit style egg prison has been :P<!--QuoteEnd--></div><!--QuoteEEnd-->
    Except the ones that cut out that special stage system altogether :v:
     
  13. Mercury

    Mercury

    His Name Is Sonic Tech Member
    <!--quoteo(post=491279:date=Aug 14 2010, 07:58 PM:name=Mad Echidna)--><div class='quotetop'>QUOTE (Mad Echidna @ Aug 14 2010, 07:58 PM) <a href="index.php?act=findpost&pid=491279"><img src="public/style_images/retro/snapback.png"></a></div><div class='quotemain'><!--quotec-->I propose this become a standard addition to all sonic hacks, as the 8 bit style egg prison has been :P<!--QuoteEnd--></div><!--QuoteEEnd-->
    What do you mean by the "8 bit style egg prison"? Forgive my ignorance.
     
  14. Black Squirrel

    Black Squirrel

    Fifty paces towards the sun, cooking beets. Wiki Sysop
    5,002
    3
    18
    Northumberland, England
    The soil knows all.
    For the record the behaviour is the same in Sonic & Knuckles's bonus stage as it is in regular Sonic 1.

    So this was never "fixed" officially.
     
  15. Azu

    Azu

    I must be stupid. Member
  16. Wow, does this make a difference when I play the game! The special stages are less of a pain in the ass now. Thanks for sharing this!
     
  17. Briraka

    Briraka

    Bloody Robot
    20
    0
    0
    Yes, thank you Mercury, for making the special stages less of a pain to get through. :)
     
  18. Namagem

    Namagem

    Member
    388
    0
    16
    USA
    2010: Mercury calls Yuji Naka out.
    2011: Yuji Naka joins Sonic Retro
    2012: Yuji Naka pwns the entire forum by making a sonic hack so awesome it is never topped. The community crumbles in shame.

    That being said, this is an awesome tweak. I must be too used to the old controls, because I keep failing hard.
     
  19. Phos

    Phos

    Going for the high score on whatever that little b Member
    3,318
    0
    0
    I always thought it was because Sonic is always jumping from a roll.

    I just thought of the jump as shooting Sonic forwards. Thinking of it like a platforming jump makes you think you have more control than you really do.
     
  20. Frozen Nitrogen

    Frozen Nitrogen

    Wouldn't the door have been easier? Wiki Sysop
    <!--quoteo(post=491975:date=Aug 16 2010, 05:03 PM:name=Namagem)--><div class='quotetop'>QUOTE (Namagem @ Aug 16 2010, 05:03 PM) <a href="index.php?act=findpost&pid=491975"><img src="public/style_images/retro/snapback.png"></a></div><div class='quotemain'><!--quotec-->2010: Mercury calls Yuji Naka out.
    2011: Yuji Naka joins Sonic Retro
    <b>2012: Yuji Naka pwns the entire forum by making a sonic hack so awesome it is never topped. The community crumbles in shame.</b><!--QuoteEnd--></div><!--QuoteEEnd-->
    ...welcome to 1994?
     
Thread Status:
Not open for further replies.