MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / integerSinePrecisionHigh

Function integerSinePrecisionHigh

src/Math/src/Trigonometry.cpp:223–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221 }
222
223 int32_t integerSinePrecisionHigh(uint16_t direction, int32_t magnitude)
224 {
225 // Build the full sine wave from the quarter wave by subtraction of direction/magnitude
226 // Note: ~ bitwise negation important for both to match vanilla
227 const auto sineIndex = ((direction & (1 << 12)) ? ~direction : direction) & 0xFFF;
228 const auto value = (direction & (1 << 13)) ? ~Data::kQuarterSine[sineIndex] : Data::kQuarterSine[sineIndex];
229 return value * magnitude / 0x8000;
230 }
231
232 int32_t integerCosinePrecisionHigh(uint16_t direction, int32_t magnitude)
233 {

Callers 3

placeTreeClusterFunction · 0.85
TESTFunction · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68