-
Notifications
You must be signed in to change notification settings - Fork 0
Units
The Playstation had no floating point hardware, and subsequently positions in Silent Hill appear to be fixed point numbers in the Q format, with a varying number of fractional bits depending on the task at hand.
Harry and the camera are likely positioned by Q20.12 values, producing a coordinate system where one unit is equal to one meter, or one world tile (e.g. the square sidewalk pavers seen in the normal world). 0,0 is thus placed roughly at the intersection of Bachman Road and Matheson Street.
These don't seem to be stored in a Q format; whether assuming degrees or radians, and testing various data types (16 bit short, 32 bit int) with various fractional bit counts, nothing pops out as an obvious "correct" answer. Rotations look to be just 16 bit values with 12 significant bits, for a total of 4,096 possibilities. Turning Harry to the right (counter-clockwise rotation when looking toward the negative vertical axis, i.e. looking up) increases the value until 0xFFF, at which point it rolls over to 0x0 and starts again. It's a simple matter to map these values to degrees or radians, so there's likely no need for any exotic data formats to be uncovered.
- A wrinkle exposed by poking around some RAM dumps with Ghidra is that 8 bits of a 12 bit rotation value are sometimes used as an index into an array, suggesting they may indeed be Q8.4 numbers, with the integral component serving as the index. This is only a wild hypothesis at the moment, and should not be taken as gospel. With any luck further investigation will clarify what's going on.