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. Billy


    RIP Oderus Urungus Member
    Colorado, USA
    Indie games
    Definitely interesting to see the official terminology used. Why did I think "the Sonic 2 patent" was for the Aquatic Ruin Zone loop that also has a path through it? Bad memory?

    Sillier note, I'm sure you're supposed to pronounce "sloop" as s-loop (it's even "S. loop" in the flow chart), but I can't help but read it as if it were a sound effect. Sloop!
    • Like Like x 1
    • Agree Agree x 1
    • List
  2. Devon


    Powered by a malfunctioning Motorola 68000 Tech Member
    your mom


    I personally concluded to "action number" when I saw that the file that contained the code for updating objects in Sonic CD Gems Collection was called "ACTION.C", with the main function that iterates through each object and calls their code "action()".
    Last edited: Sep 14, 2023
    • Like Like x 3
    • Informative Informative x 1
    • List
  3. Clownacy


    Tech Member
  4. Devon


    Powered by a malfunctioning Motorola 68000 Tech Member
    your mom
    I personally don't really think the functions for handling solid/platform objects were included in Sonic's file.
  5. Brainulator


    Regular garden-variety member Member
    This has since been corrected; thankfully, the prototypes have linker data that is missing in the final.
    • Informative Informative x 1
    • List
  6. BenoitRen


    I'm trying to come up with what would be the official-sounding, or representative, type names for some of the data structures of Sonic CD, so here's some thoughts:

    From the patent text, we have "sprite status table". I thought a "table" in assembler is what's called an "array" in C, but it seems to refer to any collection of data, even what's called a "struct" in C. But if that's true, then every data structure is a table, so it's kind of redundant. In light of this, I'd call the data type "sprite status".

    Each sprite status has a pointer to what's called a "pattern table". In the C code, this data structure is little more than a wrapper around an array, as the data members consist of a counter and an array. Curiously, the array itself is defined as an anonymous union of an array with 20 elements and an array of unknown size. The names of the arrays are spra and spr, respectively, suggesting that this is not a pattern table, but a sprite table.

    As for the data structure contained in the array, it doesn't seem to be the pattern itself, but data associated to it. It consists of four numbers called xoff, yoff, etc and index. I'm guessing this is what the community calls a "mapping"? The collection of which is used to make one sprite. Which would mean that the data structure holding them together can't be a sprite table (as it's not a collection of sprites), but is indeed a pattern table.

    But calling the data structure "pattern table" sounds too generic. "sprite patterns", maybe? Or "sprite pattern table"?

    When it comes to naming the data structure that has pattern data, there are no hints at all. As far as I know, "mapping" is a term not based on any information related to the source code. If I had to choose something, though, "pattern mapping" seems to fit.

  7. MainMemory


    Kate the Wolf Tech Member
    It is worth noting that Sonic CD's PC and Gems ports use a completely different sprite format than the original MCD version (which used the same formats as Sonic 1).