don't click here

Everything That I Know About Sonic the Hedgehog's Source Code

Discussion in 'General Sonic Discussion' started by Clownacy, Mar 30, 2022.

  1. Kilo

    Kilo

    Starting new projects every week Tech Member
    1,258
    1,196
    93
    Canada
    Changes with the weather
    Slowly chipping away at my source code recreation again. Right now I'm working on the sound driver. While I'd have to wait until I'm entirely done to make a note on all the changes, let's look at the PSG envelopes, and compare the differences between Sonic 1 and Sound Source.
    PSG Envelope 3 which is a whistle like sound was lengthened, smoothed, and made a little louder:
    Code (Text):
    1. Sound Source:
    2. EV3    EQU    $
    3.     DB    0,0,1,1,3,3,4,5,TBEND
    4.  
    5. Sonic 1:
    6. EV3    EQU    $
    7.     DB    0,0,1,1,2,2,3,3,4,4
    8.     DB    5,5,6,6,7,7,TBEND
    Next, envelope 6. This is a tone that goes down. Strangely you may have noticed that it's data actually comes before 5. This is because in Sound Source, envelope 6 doesn't have an end code, and let's itself go into envelope 5's data, turning it into a lowering and then rising tone. Sonic 1's envelope 6 is also a step quieter and faster.
    Code (Text):
    1. Sound Source:
    2. EV6    EQU    $
    3.     DB    4,4,4,4,3,3,3,3,2,2,2,2
    4.     DB    1,1,1,1
    5. EV5    EQU    $
    6.     DB    0,0,0,0,0,0,0,0,0,0
    7.     DB    1,1,1,1,1,1,1,1,1,1
    8.     DB    1,1,1,1,2,2,2,2,2,2
    9.     DB    2,2,3,3,3,3,3,3,3,3
    10.     DB    4,TBEND
    11.  
    12. Sonic 1:
    13. EV6    EQU    $
    14.     DB    3,3,3,2,2,2,2,1,1,1,0,0,0,0,TBEND
    Envelope 7 is entirely different. In Sound Source it's a single step with a value of 2 labelled as a hihat. While in Sonic 1 it's another rising tone.
    Code (Text):
    1. Sound Source:
    2. EV7    EQU    $
    3.     DB    2,TBEND            ;HIHAT
    4.  
    5. Sonic 1:
    6. EV7    EQU    $
    7.     DB    0,0,0,0,0,0,1,1,1,1,1
    8.     DB    2,2,2,2,2,3,3,3,4,4,4
    9.     DB    5,5,5,6,7,TBEND
    Sonic 1 also has a 9th envelope not present in Sound Source, which plays every value in a rising tone.
    Code (Text):
    1. EV9    EQU    $
    2.     DB    0,1,2,3,4,5,6,7,8,9
    3.     DB    AH,BH,CH,DH,EH,FH,TBEND
     
    • Informative Informative x 1
    • List
  2. ndiddy

    ndiddy

    Member
    49
    68
    18
    Some stuff that ehw dug up:
    - The tool used to create Nemesis compressed data was called "CMM", or "Character Maker MarkV" and was written by Yuji Naka: https://x.com/U1_Toyama/status/1119277351076896769
    - There's some usage information for CMM in Tom Payne's papers.
    image1469_resized.jpg
     

    Attached Files:

    • Informative Informative x 4
    • Like Like x 1
    • List
  3. BenoitRen

    BenoitRen

    Tech Member
    904
    547
    93
    I've been comparing Sonic CD's Tamabboh 68000 code to the C version's. It looks like the official name of what disassemblies call ObjGetFloorDist is emycol_d. Note that this function is unused in Sonic 3.
     
    • Informative Informative x 2
    • List
  4. Kilo

    Kilo

    Starting new projects every week Tech Member
    1,258
    1,196
    93
    Canada
    Changes with the weather
    The unused function in Sonic 3 is something else called CheckFloorDist, emycol_d there is ObjCheckFloorDist and is used a lot. The Sonic 3 disassembly's not really complete, so it's a bit confusing.
     
    • Informative Informative x 1
    • List
  5. Brainulator

    Brainulator

    Regular garden-variety member Member
    I'm pretty sure "emycol_d" also shows up in Sonic 2 Nick Arcade, and it's used by the Redz enemy, at least.
     
  6. Kilo

    Kilo

    Starting new projects every week Tech Member
    1,258
    1,196
    93
    Canada
    Changes with the weather
    It's a generic floor collision check for all actors that aren't Sonic. It's present in every game, and is probably one of the oldest subroutines as it was named after the goblin enemy from TTS which would've been the only actor at the time to use it, otherwise it would've been called actcol_d.
     
    • Informative Informative x 4
    • Like Like x 1
    • List