How-to: Fix the Caterkiller damage bug

Discussion in 'Tutorials Archive' started by Selbi, Oct 10, 2015.

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

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    It feels a little weird to do a tutorial again, especially after such a long time of not having done any (my last one was in 2010). However, after playing some hacks for the upcoming Hacking Contest in private already, I noticed how many of them still have this particular bug in, and it just pisses me off nowadays.


    [​IMG]
    I'm not sure if he's trying to look evil or if he's just having a hard time to fart.

    Basically, when you roll really, really fast into a Caterkiller from Marble Zone and Scrap Brain Zone, you will still get damaged despite having destroyed it. In the original game this wasn't really much of a noticable issue, since the locations where you can even gain enough speed to roll this fast are scarce, if they exist at all. But in these modern days, where everyone and their grandma decides to add Spin Dash and slopes directly into Caterkillers, it became a very obvious problem.

    The issue is that the spiked body segments of that badnik actually don't get deleted on destroying the head, but rather 1 frame later. So if you happen to roll fast enough to travel the distance to the body in that single frame, you still get damaged.

    Fixing it literally takes a single line. Go to loc_16C7C and add this below the label:

    Code:
            clr.b    $20(a1)
    Now, when a Caterkiller is being destroyed, all touch response values (which are responsible for objects being solid, breakable, damaging, etc.) from the body spikes are getting set to 0, which essentially means harmless and without collision.
    (To those interested, no, simply deleting these body segments right away won't work (at least when I tried it myself), because that for some reason stops the smoke cloud from appearing.)

    I pray that this helps to eradicate this godforsaken bug from all future hacks, because the next time I see someone building a slope in Marble Zone that leads directly into a Caterkiller without this being fixed I will eat their fucking face.
     
    Last edited: May 26, 2016
  2. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,020
    Ha. ReadySonic gave the thing its own type of collision response, IIRC. Nice to see something a little more direct.
     
  3. nineko

    nineko I am the Holy Cat Member

    Joined:
    Mar 24, 2008
    Messages:
    1,902
    Location:
    italy
    I can't believe there wasn't a fix for this yet, in plain Sonic 1 there are a few locations where it can happen, maybe I can record a video to advertise your tutorial...
     
  4. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    ​That would be really nice!
     
    Last edited by a moderator: Oct 10, 2015
  5. AURORA☆FIELDS

    AURORA☆FIELDS so uh yes Exiled

    Joined:
    Oct 7, 2011
    Messages:
    759
    HA, beat you to it, Selbi. I fixed this bug weeks ago, by removing the body segments a single frame earlier. It was just case of removing routine ID's which lead to DeleteObject to DeleteObject calls IIRC. Ill have to confirm this on my source 

    EDIT: Decided I could make up a quick tutorial to fix it like I did. So, first, go to loc_16ABC and you will see this

    loc_16ABC:
    move.b #$A,$24(a0) ; run "Obj78_Delete" routine
    rts
    ; ===========================================================================

    Obj78_Delete: ; XREF: Obj78_Index
    jmp DeleteObjectReplace it with following:

    loc_16ABC: ; immediately delete
    Obj78_Delete:
    jmp DeleteObject
    Next, at loc_16C7C, you will see this:

    loc_16C7C:
    move.b #$A,$24(a0)

    loc_16C82:
    jmp DisplaySpritewe can replace it with:

    loc_16C7C:
    bra Obj78_Delete ; delete immediately

    loc_16C82:
    jmp DisplaySprite
    Whoops that is everything. This should fix the same issue as Selbi's fix, except do it "properly". At least in my hack this causes no different behaviour than get rid of the body segments a single frame earlier, avoiding the issue of getting hurt when moving fast.
     
    Last edited by a moderator: Oct 10, 2015
  6. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    I don't see how this does anything more "properly", as the effects within the game aren't noticably different, but I appreciate the effort. Mostly though, this tutorial was made because there was none yet, which I absolutely cannot understand.
     
  7. AURORA☆FIELDS

    AURORA☆FIELDS so uh yes Exiled

    Joined:
    Oct 7, 2011
    Messages:
    759
    yeah I agree, I just though because this addresses the issue while yours... "avoids it" for no better expression. Nonetheless both fix the issue so it doesnt matter which version is implemented, and am glad you wrote it.
     
  8. EMK-20218

    EMK-20218 The Fuss Maker Exiled

    Joined:
    Aug 8, 2008
    Messages:
    1,067
    Location:
    Jardim Capelinha, São Paulo
    Awesome one! I waited for this during years!! As always... Thanks a lot, Selbi! Thank you very much!!
     
Thread Status:
Not open for further replies.