sadx technobabble dump

Discussion in 'Discussion and Q&A Archive' started by Dude, Jan 3, 2009.

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

    Dude Active Member Member

    Joined:
    Dec 25, 2008
    Messages:
    29
    Location:
    South Central MA
    stuff I didn't write:


    guide to the model format


    Stuff I did write:


    I'm going to start posting more of my incomplete findings... mostly for completeness sake.


    Earlier tonight I stumbled upon the loading cue, if you will, for special-use geometry in emerald coast. By special use, I mean sky boxes, death planes, water, etc. Anything where the code goes beyond simple "render this, read collision data". The problem with this is that I think its mostly program instructions and not variables, and even the tiniest alterations are crashing before I can even note their effect.


    I also found three references to the skybox - which corresponds to the amount of times it is used (once per segment), they reside at:



    Code:
    keyed pointer value 17019504
    
    
    
    Instances:
    
    1011372
    
    1011775
    
    1012025


    The loading function seems to process things in chunks (obviously), and interestingly enough it uses the byte 0x68 to determine where the end of one chunk is, and where the beginning of the next one is. However, it isn't consistent whatsoever, and editing things inside of the chunks isn't doing anything productive at all (even copy-pasting data from similar objects is causing the loader to crash) I think this is where geometry objects that are instanced (ie: more than one copy of exactly the same thing). Also, the examples I listed above are pretty simple, but still confusing the hell out of me. I know it works a little something like this:



    Code:
    chunk marker
    
    pointer to seg struct
    
    unknown (seems to be one byte and two shorts?)
    
    chunk marker


    Now I realize I'm probably the only person who gives a damn about this game, but I'm at a block here with the loading routine. If someone else could take a look into it, I'd be very appreciative.



    Objects that don't fall under the special use category aren't listed here, but rather go under the collision structure (which is what I'm using for my level edits btw) How the game calculates collision (and also surface properties) is as follows:



    start with 3 coordinates for an origin. Use the 4th float as a radius, and make a detection sphere using this data. The game constantly checks to see if sonic is inside this sphere, and if he is, it'll run the following surface properties. You can set basically any object to from non-solid to solid by making the flags read 01001080



    Code:
    Collision data
    
    Unfinished
    
    
    
    
    
    Struct Collision Data 0x24
    
    Float X position; //
    
    Float y position; //
    
    Float z position; //
    
    Float Spheresize; //
    
    Float Unknown; //
    
    Float padding; //
    
    Dword Objectpointer; // points to OBJECT struct
    
    Dword Unknown; // 
    
    Short Unknown flags; // 01
    
    Short Surface Flags; // These can hurt sonic, support sonic, take traction, etc
    
    
    
    Unknown flags
    
    0 - no collision
    
    1 - default
    
    2 - weird alpha
    
    
    
    Surface flags (first byte)
    
    type
    
    1x = can land on
    
    2x = push
    
    3x = push
    
    4x = Kill sonic
    
    5x = no alpha, no col
    
    6x = water
    
    7x = lighting
    
    8x = Stage Specific on/off (EC footprints)
    
    9x = normal surf
    
    
    
    behavior
    
    x0 = normal
    
    x1 = hurt
    
    x2 = low traction
    
    x3 = hurt
    
    
    
    Surface Flags (second byte)
    
    Visibility
    
    1x = invisible (still solid)
    
    8x = visible
    
    
    
    Alpha blending
    
    x0 = normal
    
    x1 = blending mode 1
    
    x2 = blending mode 2


    Also, here's some tidbits on the player starts



    Code:
    =========================
    
    Spawnpoints - better known as 'player starts', these define where in a map to start the player. Spawn point entries are always 0x14 bytes long
    
    =========================
    
    
    
    short x_rotation; // rotation values might not really be stored here, just a guess
    
    short y_rotation; // 
    
    short z_rotation; // 
    
    short segue; // seems to affect how the spawn point is interpreted. Editing this can cause the player to start at 0,0,0
    
    float x_position;
    
    float y_position;
    
    float z_position;




    Code:
    And Sonic's 'attack' state. This address jumps around, so I'm not going to list it until I find a pointer address.
    
    00 - completely vulnerable, no jump ball.
    
    05 - attack mode, can't be hurt by enemies, but not invulnerable. Jump ball will show if this is active
    
    02 - light dash charged and holding, sonic will glow.




    Code:
    Material Struct -  keep bugging me to update this, so I'll actually do it
    
    ================================
    
    Byte Blue_Diffuse; // This is the amount of blue light to add to the diffuse (texture) channel
    
    Byte Green_Diffuse; // This is the amount of green light to add to the diffuse (texture) channel
    
    Byte Red_Diffuse; // This is the amount of red light to add to the diffuse (texture) channel
    
    Byte Alpha_Diffuse; // This is the transparency for the texture channel
    
    Byte Blue_Specular; // This is the gloss or specularity, blue channel
    
    Btye Green_Specular; // This is the specularity, red channel
    
    Byte Red_specular; // This is the specularity, green chanel
    
    Byte Alpha_specular; // This is the transparency for the specularity
    
    Float unknown; // seems to act like a float most of the time
    
    Byte TexID; // this is the pvr to load... not a gbix - I think the gbix is interpreted somewhere in the pvm caching function
    
    Byte SomethingImportant; // crashes when put to FF
    
    Byte unknown2[3]; //
    
    Byte unknown3; // seems to be Ax (x being a variable)
    
    Byte Spheremap; // first bit - U clamping, second bit - V clamping. Set to 21 to get normal uvs, set to 66 for screen mapping
    
    Byte EndOfStruct; // always 94

    edit: More structures added, fixed material struct it was horribly outdated, and STILL IS ARGH
     
    Last edited by a moderator: Jan 4, 2009
Thread Status:
Not open for further replies.