Want more features on Pastebin? Sign Up, it's FREE!
Guest

SADX Cam File Format

By: a guest on Jul 18th, 2015  |  syntax: None  |  size: 5.08 KB  |  views: 197  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print  |  QR code  |  clone
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Camera file
  2.  
  3. ==========================
  4. Header (0x80 bytes)
  5. ==========================
  6.  
  7. dword camera_num; //tells the game how many cameras to load
  8. Array(0x3C) Padding; // filler until the first camera
  9. cam(0x40) default info // usually a type 00 cam, defines some default parameters. Normal camera data doesn't start until after this
  10.  
  11. ==========================
  12. camera structure (0x40 bytes)
  13. ==========================
  14. Byte Camera Type; // Type of camera (I'm guessing this is actually bitflags)
  15. Byte unknown; // frequently unused, could be part of the camera type variable
  16. Byte pan_speed; // number of frames it takes for a camera to complete it's transition. 1 frame = 33 ms (1b creates strange behavior! Lots of camera 'snapping' around)
  17. Byte priority; // 0 doesn't activate, 2 is used for respawn cams. 1 does something else. This might be trigger method, actually. 2 meaning 'triggered by sonic'
  18. short unknown; (possibly x_rot or z_rot)
  19. short y_rot;
  20. float position[3]; // x,y,z location of box center
  21. float scale[3]; // If you make a 2 x 2 x 2 cube and use these values as scale, you should have an accurate volume representation
  22. int Unknown; // is usually zero. Sometimes it hits values like 0x20 0x40 or 0x60. In the default camera settings it can be totally different, looking
  23. float point1[3];
  24. float point2[3];
  25. float variable;
  26.  
  27.  
  28. ==========================
  29. Camera Types
  30. ==========================
  31. 14 = fixed camera,  locking (keeps focus until overwritten)
  32.         point1 appears unused
  33.         point2 is camera location
  34.         variable is field of view
  35.  
  36. 15 = fixed camera, free (releases when you leave it)
  37.         point1 appears unused
  38.         point2 is camera location
  39.         variable is field of view
  40.  
  41. 18 seems to be another type of fixed camera
  42.  
  43. 1F is also a locking orbital camera
  44.         Currently indistinguishable from 27, aside from that it doesn't need
  45.         a priority in most cases
  46.  
  47. 20 - seems to be a 'double orbital cam' (locking)
  48.         point 1 is orbit 1
  49.         point 2 is orbit 2
  50.         no idea on how they link/pick from eachother yet
  51.         variable is distance
  52.  
  53. 27 = orbital camera, locking (keeps focus until overwritten)
  54.         point1 is orbit center
  55.         point2 appears unused
  56.         either sphere or cube collider
  57.         last variable is camera distance
  58.  
  59. 23 - orbital camera, temporary (releases when you leave it)
  60.         point1 is orbit center
  61.         point2 appears unused
  62.         last variable is camera distance
  63.  
  64. 04 - free cam, unlocks the focus point
  65.  
  66. 42 - Windy valley orbital camera (keeps focus until overwritten)
  67.         dimensions 1 and 2 function like normal, dimension 3 needs to be huge to work.
  68.         point1 is camera focal point
  69.         point 2 is is for setting the view angle. It either uses this as part of an angular math function, or it's trying to keep that point onscreen at all times. I can't tell
  70.         last variable is camera distance. Small distances will occlude player if necessary.
  71.        
  72. 28 - seems to work with no priority (00) set? Check this.
  73.  
  74. 28 - Emerald coast, lower deck island unlock, free-follow cam
  75.         NotUsed value is 80!
  76.         PanSpeed is 17
  77.         Not sure what points A and B do, although point B is above box, point A is below it
  78.         priority is 2
  79.         unknown 1 is 5
  80.         variable is probably distance
  81.  
  82. Need to try: 3d, 1d, 0b, 07, 16, and 0f
  83.  
  84. Type bitwise comparisons:
  85. 00100011 (0x23) - unlock orbit camera? spherical or cube collider (definitely uniformly scaled though)
  86. 00100111 (0x27) - locked spherical or cube collider (uniformly scaled) (orbital, point A)
  87. 00011111 (0x1F) - locking orbit camera
  88. 00010100 (0x14) - locked fix camera (uses point B)
  89. 00010101 (0x15) - unlocked fix camera
  90. 00000100 (0x04) - unlock, apply free cam
  91. 00111101 (dec 61) - Unlock, spherical or cube collider (uniformly scaled) (fix cam point B) (L/R rotations are also disabled)
  92. 00011111 (dec 31) - Locking, 3 scale rectangular collider. Pan speed scales to character on-ground speed. Sonic is kept near the bottom of the frame
  93. 01000010 (0x42) - WV orbital locking camera
  94. 00001000 (0x08) - Emerald Coast unlocking orbit cam, outer
  95. 01000000 (dec 28) - strange emerald coast follow cam, inner
  96.  
  97. There is probably a flag inside of this bitarray that enables/disables cameras colliding with the world
  98. Another analyzed behavior that isn't yet understood on a technical level is colliders that only activate when the player touches the ground
  99. At least one flag inside of this bitarray tells the camera zone to handle the collider volume in a nonstandard way. I've found one camera zone in Emerald Coast that *has* to be using either a cube or a spherical collider. I'm almost 100% certain that the only 'scale' value being used for scale is the Z value (starting to lean more towards X value now that I've looked at some other colliders). We can test the difference between sphere and cube by:
  100. - first finding the flag in question, and finding what the 'default' rectangle state is.
  101. - set the collider to 'cube/sphere' mode
  102. - rotate the collider 45 degrees
  103. - seeing if we can get within a spherical radius without it moving to the new position. If you can, that means it's a cube. If not, it's a sphere
  104.  
  105. flag #3 might be non-rectangular collider
  106. flag #6 might be locked (possibly contradicted by 0x15, as well as 0x42)
clone this paste RAW Paste Data